break out of a program

David Raymond David.Raymond at
Fri Apr 19 12:29:08 EDT 2019

The normal way of saying you want to exit the whole program is with sys.exit()

You can optionally give it the return code/exit status you want the interpreter to give to the OS when it exits.

-----Original Message-----
From: Python-list [ at] On Behalf Of Tamara Berger
Sent: Friday, April 19, 2019 10:38 AM
To: python-list at

Hi Python-List,

What code can I use to break out of a program completely, and not just out
of a loop? I wrote code with 3 conditions for saving for a downpayment. The
first addresses cases that don't meet the minimum condition; i.e., enough
money to save for a downpayment within the allotted time. It has its own
print line, but also executes the irrelevant print lines for the other two


More information about the Python-list mailing list