summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calculator.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/calculator.py b/calculator.py
index 37bf39b..82b41e2 100644
--- a/calculator.py
+++ b/calculator.py
@@ -110,7 +110,17 @@ def Factor(e: [Token]) -> (int, [Token]):
         from math import factorial
         e.pop(0)
         r = float(factorial(int(r)))
+    
+    # cancer
+    assert 'r' in locals()
     return r, e
 
 # where is my compose
-Evaluate = lambda x: Expression(Tokenize(x))[0]
\ No newline at end of file
+Evaluate = lambda x: Expression(Tokenize(x))[0]
+
+if __name__ == '__main__':
+    while True:
+        try:
+            print(Evaluate(input("> ")))
+        except Exception as e:
+            print(e)
\ No newline at end of file