Unexpected output from a calculation. Help with a rounding issue

x = 16
epsilon = 0.01
step = 0.1
guess = 0.0

while guess <= x:
if abs(guess**2 -x) < epsilon:
break
else:
guess += step
print(guess)

I haven’t understood how the output came 4.9999999998?

The output will be : 4.000000000000002

>> print(abs(4.000000000000001**2 -16) < 0.01)
True

simply Because your if condition if abs(guess**2 -x) < epsilon: will evaluates to True and thus
you will break out of the loop and print(guess)