-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalcMain.py
More file actions
57 lines (34 loc) · 1.24 KB
/
CalcMain.py
File metadata and controls
57 lines (34 loc) · 1.24 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from BasicCalculator import Calculator
from os import system, name
import os
def clear():
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
def main():
pdir = os.path.dirname(__file__)
helppath = os.path.join(pdir, 'README.txt')
print("Welcome! Calculator running...")
print("For help using the calculator type \"?\"\n")
while True:
user_input = input("Input: ")
if user_input == "exit":
clear()
print("Exiting calculator...")
return
if user_input == "?":
clear()
print("To view the contents displayed here at any time, simply read the README in this program package\n")
with open(helppath, 'r') as f:
print(f.read())
if(input("\nPRESS 'B' KEY AND PRESS ENTER TO GO BACK") == 'b'):
clear()
print("Welcome! Calculator running...")
print("For help using the calculator type \"?\"\n")
continue
calc = Calculator()
calc.setExpr(user_input)
print("=", calc.calculate)
if __name__ == "__main__":
main()