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()