How to create endless loop until user until breaks the loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to create endless loop until user until breaks the loop?

28th Feb 2021, 6:31 PM
Hasan Koçyiğit
Hasan Koçyiğit - avatar
3 Answers
+ 1
Can you give one example?
28th Feb 2021, 6:50 PM
Atul [Inactive]
+ 1
while True: If input("break? ") == "yes": break
28th Feb 2021, 7:18 PM
iDaN
iDaN - avatar
+ 1
Depends on what you need. If you don't wanna ask the user every iteration of the loop if he wants to exit, you can simply rely on CTRL-C or the close button.
28th Feb 2021, 9:06 PM
inxanedev!
inxanedev! - avatar