0

How do u rewrite this code without a boolean loop(while True)?There should still be a loop but not a boolen one

https://code.sololearn.com/cvVAYPF9TsE0/?ref=app

15th Feb 2022, 3:51 PM
Lenoname
7 Réponses
+ 1
Manav Roy yes instead of while True i want to use while ’something’
15th Feb 2022, 4:32 PM
Lenoname
+ 1
ravilnicki Thats what i’m looking for, instead of while True i want while ’something’
15th Feb 2022, 4:32 PM
Lenoname
+ 1
You can define a variable (i) i = 0 And iterate it with a while loop. while i < 10 : i+=1 This code runs 10 times, If you want it to be infinite, Remove the i+=1. What does i+=1 do? A while loop runs as long as the condition (i is less than 10) is True. So if we add 1 to i every single time it runs, i will reach 10 after 10 executions and the condition becomes False.
15th Feb 2022, 11:49 PM
Gurseerit Singh Chahal ✓
Gurseerit Singh Chahal ✓ - avatar
0
ravilnicki while True/False has only two results, thats why i called them boolean. What i meant is to write the same code without a while True loop.
15th Feb 2022, 4:07 PM
Lenoname