No subject

Shakti Kumar shakti.shrivastava13 at gmail.com
Fri Apr 19 13:22:53 EDT 2019


On Fri, 19 Apr 2019 at 9:33 PM Tamara Berger <brgrt2 at gmail.com> wrote:

> Hi Python-List,
>
> What code can I use to break out of a program completely, and not just out
> of a loop?


import sys
sys.exit()

Should do your work.

>

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.


However anyone would suggest to put the prints in the proper if else block
rather than going for an exit.

>

> --
> https://mail.python.org/mailman/listinfo/python-list


Thanks,
Shakti.

> <https://mail.python.org/mailman/listinfo/python-list>
>
-- 
Sent from Shakti’s iPhone



More information about the Python-list mailing list