type quit( and press enter you see the prompt again type echo %errorleveland press enter you see the error codeas shown in figure - when working with platforms other than windowsyou may need to type something other than echo %errorlevelfor examplewhen working with bash scriptyou type echo instead figure - add an error code when needed to tell others the python exit status one of the most common nonstandard exit methods is to simply click the command prompt' or terminal' close button using this approach means that your application may not have time to perform any required cleanupwhich can result in odd behaviors it' always better to close python using an expected approach if you've been doing anything more than simply browsing you also have access to number of other commands for closing the command prompt when needed in most casesyou won' need these special commandsso you can skip the rest of this section if desired when you use quit(or exit()python performs number of tasks to ensure that everything is neat and tidy before the session ends if you suspect that session might not end properly anywayyou can always rely on one of these two commands to close the command promptsys exit(os _exit(