Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
while true loop
#1
how do I break out of a While True loop in python3
Reply
#2
Take a break.
Reply
#3
I faced similar issue as you (not knowing which google result out of so many to open)

https://wiki.python.org/moin/WhileLoop
Break example in second code snippet
Reply
#4
It is worth noting that a non-null entry evaluates to True, so it is common to have a loop that prompts a user to enter something or just return to exit:
while True:
    answer = input("Enter a phrase (enter alone to exit): ")
    if not answer:
        break
    print(f'You entered {answer}.')
print('All done.')
I am trying to help you, really, even if it doesn't always seem that way
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python calculator help but not using while loop with true, any flags variable ,break kirt6405 13 5,899 Jun-08-2021, 06:39 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020