0

Can't float be used in while loop

Input x=999.0 while x>=1.0: x-=0.5 Output 999.0 999.0 999.0 ...till timed out Why is this happening

12th Dec 2019, 1:58 PM
Umar] Rare
Umar] Rare - avatar
2 Respostas
+ 1
its valid (kinda) x=999.0 while x>=1.0: print(x) x-=0.5
12th Dec 2019, 2:25 PM
Choe
Choe - avatar
- 1
You forgot to add a space in the third line, so the while loops serves no purpose and x will always be 999
12th Dec 2019, 2:31 PM
coddy
coddy - avatar