+ 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

28th Nov 2023, 9:10 PM
adam sdiri
adam sdiri - avatar
2 Respuestas
+ 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".
28th Nov 2023, 9:16 PM
Solo
Solo - avatar
+ 2
Oh thx
28th Nov 2023, 9:31 PM
adam sdiri
adam sdiri - avatar