-
Notifications
You must be signed in to change notification settings - Fork 1
Background Info
This repository is just one file that is a Python 3 Calculator. It was originally a Python experiment (I was new to Python at that point), but the objective slowly changed. The first few lines are part of my experimenting, so if you are using this for calculating purposes, please ignore them. They appear as little meaningless strings of numbers, letters, and forward slashes propping up before the menu. If you are really annoyed, delete everything before 'def add(a, b):'. I have based some of this code off some sample code from the Raspberry Pi site.
I have made a modification to how the loop exits. This modification is made so that the loop exits cleanly. The old code said this:
while True:
while choice not in choices:
Later in the code:
exit()
choice = '0'
While the new code says this:
while not readytoquit:
while not readytoquit and choice not in choices:
Later in the code:
readytoquit = True
choice = '0'
If not for this modification, the Python IDE asks to kill the application, which is the result of the loop not exiting cleanly. Also, the loop might keep running while the app is closed, because the conditions for it to keep going might be met. This means it could unintentionally keep the processor running.
I hope you like my calculator!
Note: This is a Python 3.6.1 shell program, which requires Python IDLE 3.6.1 to run. Also, I have confirmed that this calculator works through to Python IDLE 3.7.