I don't understand why does this code enter an infinite loop. I've tried debugging to see the problem but that didn't help much. The program keeps looping between the while and first if statement.
x = 25
epsilon = 0.01
step = 0.1
guess = 0.0
while guess <= x:
if abs(guess**2 -x) >= epsilon:
guess += step
if abs(guess**2 - x) >= epsilon:
print('failed')
else:
print('succeeded: ' + str(guess))