Python Forum
First Try Skynet... How Can I improve?
Poll: Rate MY Code
You do not have permission to vote in this poll.
Bad
0%
0 0%
Okay
0%
0 0%
Good
0%
0 0%
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First Try Skynet... How Can I improve?
#6
It's AN option, not the only option.  And, in my opinion, it's the worst option.  A better option would be to wrap all your code in a function, and then call it.  When you want to quit, just return instead.
def main():
    while True:
        keep_going = input("Keep going? ")
        if keep_going.lower() not in ("y", "yes", "1", "true"):
            return

if __name__ == "__main__":
    main()
Reply


Messages In This Thread
RE: First Try Skynet... How Can I improve? - by nilamo - Oct-05-2017, 02:53 PM

Forum Jump:

User Panel Messages

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