We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47315ca commit 08d725cCopy full SHA for 08d725c
Calculator/Calcy.py
@@ -0,0 +1,38 @@
1
+# -*- coding: utf-8 -*-
2
+"""
3
+Created on Mon Jul 6 23:26:25 2020
4
+
5
+@author: Avinash Ranjan
6
7
8
+import re
9
10
+print("Magical Calculator")
11
+print("Type 'quit' to exit\n")
12
13
+previous = 0
14
+run = True
15
16
+def performMath():
17
+ global run
18
+ global previous
19
+ equation = ""
20
+ if previous == 0:
21
+ equation = input("Enter Equation:")
22
+ else:
23
+ equation = input(str(previous))
24
25
+ if equation == 'quit':
26
+ print("GoodBye, Human..!")
27
+ run = False
28
29
30
+ equation = re.sub('[a-zA-Z,:()"{}"]', '', equation)
31
32
33
+ previous = eval(equation)
34
35
+ previous = eval(str(equation) + equation)
36
37
+while run:
38
+ performMath()
0 commit comments