Reading Time: 1 minutes
Terminating your program in Python
In order to exit from a Python script/Interactive Interpreter Session/Command Prompt Session, any of the following functions can be used: exit(), quit(), sys.exit(). While calling these functions, you can provide an exit_code as the first argument. These exit codes can be used in bash scripting, where the special variable $? returns the last exit status.