1#Exit everywhere with error message
2import sys
3sys.exit("Code not Pythonical")
4
5#Exit with a specific status
6import os
7os._exit()
8
9#Exit in interpreter
10quit()
11
12#Exit in Interpreter but more user friendly
13exit()
1# Do stuff
2stop = input("Would you like to stop the program? ")
3if stop == "y":
4 exit()
5else:
6 # do stuff
1some code
2
3quit() # quit at this point
4
5some more code (that's not executed)
6