summaryrefslogtreecommitdiff
path: root/calc.py
diff options
context:
space:
mode:
authorPanFritz <redstonenoobpan@gmail.com>2015-01-17 14:33:49 +0100
committerPanFritz <redstonenoobpan@gmail.com>2015-01-17 14:33:49 +0100
commit60181bd65792c8413331bd28a37ccd1cb2fe8d21 (patch)
tree386761ee2632fbe97554defd5056d646cd51d20e /calc.py
parent9b4d73cfe27d3348e7f34dabda20ca0c70867b20 (diff)
Removed . from operators, remade line 17
Diffstat (limited to 'calc.py')
-rw-r--r--calc.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/calc.py b/calc.py
index ccecba4..2c1ed15 100644
--- a/calc.py
+++ b/calc.py
@@ -14,9 +14,7 @@ def calc(text):
expression = ""
should_calc = False
for char in text:
- if char.isdigit() or (should_calc and char in [".", " "]):
- expression += char
- elif expression and char == ".":
+ if char.isdigit() or (expression and char == ".") or (should_calc and char == " "):
expression += char
elif char in math_operators:
# calculation must include at least 1 operator