forked from ZipCodeCore/Python.ScientificCalculator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain-app.py
More file actions
35 lines (25 loc) · 693 Bytes
/
main-app.py
File metadata and controls
35 lines (25 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from calculator import Calculator
import math
def getTwoNumbers():
a = float(input("first number? "))
b = float(input("second number? "))
return a, b
def displayResult(x: float):
print(x, "\n")
def performCalcLoop(calc):
while True:
choice = input("Operation? ")
if choice == 'q':
break # user types q to quit calulator.
elif choice == 'add':
a, b = getTwoNumbers()
displayResult(calc.add(a, b))
else:
print("That is not a valid input.")
# main start
def main():
calc = Calculator()
performCalcLoop(calc)
print("Done Calculating.")
if __name__ == '__main__':
main()