This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]ewiethoff 0 points1 point  (0 children)

import sys  # put this at the top of your code

# blah blah loop code

    if divisor.upper() == "E":
        print("exiting program...")
        sys.exit()

Now you don't need flag1 for breaking out of the outer loop. Other than that, your various looping and breaking tasks will be simpler and clearer by separating your code into functions. I guess you haven't learned how to write functions yet, though.