Searching for two integers root**pwr = integer(user's input)
<p>A question from a book I have found.</p>

<blockquote>
  <p>Write a program that asks the user to input an integer and prints two
  integers, root and pwr, such that 0 &lt; pwr &lt; 6 and root**pwr is equal
  to the integer user entered. If no such pair exists, print that it is
  impossible to find such a pair.</p>
</blockquote>

<pre><code>integer = 3 #there will be raw_input but I use it as an example
root = 0

for pwr in range(1,6):

    if root**pwr != integer:
        pwr += 1
        print pwr

    else:
        print root, pwr

    if pwr &gt; 5:     
        pwr = 1
        root += 1
</code></pre>

<p>I did not complete program yet because I cannot get loop right. The problem is that I receive output 2, 3, 4, 5, 6 and then loop terminates. However, I did use restart on pwr variable in the last if statement code block you see. However, it stops to execute anyway. What is the problem here?</p>
