break out of a program

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


The normal way of saying you want to exit the whole program is with sys.exit()
https://docs.python.org/3.7/library/sys.html#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 [mailto:python-list-bounces+david.raymond=tomtom.com at python.org] On Behalf Of Tamara Berger
Sent: Friday, April 19, 2019 10:38 AM
To: python-list at python.org
Subject: 

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
conditions.

Thanks,
Tamara
-- 
https://mail.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list