+ 3

что-то пошло не так? something went wrong?

i=2 while i<=2: print(i) i-=1

22nd Jan 2021, 4:09 AM
Gafurov Ruslan🇷🇺🤩
Gafurov Ruslan🇷🇺🤩 - avatar
1 Antwort
+ 7
What were you expecting? You've set i to 2. Then you're running a while loop till i is smaller than or equal to 2, and subtracting 1 from `i` each time. So the value of `i` will keep decreasing and will always be <= 2. So it is an infinite loop that prints infinitey from 2 subtracting 1 each time
22nd Jan 2021, 4:28 AM
XXX
XXX - avatar