summaryrefslogtreecommitdiff
path: root/calc.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2015-01-02 01:28:39 +0100
committerjomo <github@jomo.tv>2015-01-02 01:28:39 +0100
commit9110fc2eda3a0018f164510f8ef840969c4d6b75 (patch)
treeac29a34fae247baa5c6893d395e17bccde74e438 /calc.py
parent0842d921871a9bd33011d35fdd554189766bcf7c (diff)
more calc improvements
Diffstat (limited to 'calc.py')
-rw-r--r--calc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/calc.py b/calc.py
index d05f876..67df074 100644
--- a/calc.py
+++ b/calc.py
@@ -14,7 +14,7 @@ def calc(text):
expression = ""
should_calc = False
for char in text:
- if char.isdigit() or char in [".", " "]:
+ if char.isdigit() or (should_calc and char in [".", " "]):
expression += char
elif char in math_operators:
# calculation must include at least 1 operator