+ 1
Why it not stopping? AND HOW CAN I FIX IT
from time import sleep i=(10/3) while True: sleep(0.005) print(i) i=(i/3) if i == "0.0": break
2 Réponses
+ 11
adam sdiri
Because you are comparing a real number with a string:
if i == "0.0":
break
You also need to round the number to the desired size:
if round(i,1) == 0.0:
break
P.S: "The sleep() function will not work in Sololearn".
+ 2
Oh thx