having trouble formatting if-else statement in python
<p>My program finds the roots using newton's algorithm. I am having trouble with a last part when if there is not enough iterations to find the root to print that the root has not been found.</p>

<pre><code>for i in range(N):
    f= evaluate(p,deg,x0)
    s=evaluate(d,deg-1,x0)
    if s==0:
        print "Can't divide by 0"
        return -1
    x1=x0 - f/s
    print ("Iteration %d" %(i+1))
    print "%f" %x0
    if abs(x1-x0)&lt;tol:
        print "Found a root %f" %x1
        return 0
    else:
        x0=x1
    if abs(x1-x0)&gt;tol:
       print "root not found"
</code></pre>

<p>somehow it seems to skip the last if statement and doesn't print anything, i tried to put it in different places. when i placed it before the previous if-statement then it skips the x0=x1 part. Im confused of whats wrong with it.</p>

<p>N is the number of iterations, x0 is the initial guess</p>
