If I had a code like this:
a=input('#something') while True: if a == 0: #Stop the program here How would I end the program?
Thanks
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack InternalIf I had a code like this:
a=input('#something') while True: if a == 0: #Stop the program here How would I end the program?
Thanks
Yes, you usually do it this way:
import sys sys.exit() If there's an error you can indicate that by passing a string as in sys.exit("oops!").
Ctrl + Cin terminal.break.input(), as you're looking for an integer there and not a string.