title: Exhaustive Enumeration python
body: <p>I need to create a program that finds the base and exponent of a single number given that the exponent is less than 7 and greater than 1. I am using python 2.7.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>def determineRootAndPower(inputInteger):
      pwr = 1
      num = inputInteger
      while (num) &gt; 0 and (0 &lt; pwr &lt; 7):
          inputInteger = inputInteger - 1
          pwr = pwr + 1
          num = num - 1
      if int(num)**int(pwr) == inputInteger:
              print(str(num) + (" to the power of ") + str(pwr) + (" equals ") + str(inputInteger) + ("!"))
      else: 
          print("No base and root combination fit the parameters of this test")
  </code></pre>
  
  <p>Can anyone give me any general advice on this issue? Right now I am always receiving the 'else' statement which is not correct.</p>