diff options
author | PanFritz <redstonenoobpan@gmail.com> | 2015-01-17 14:33:49 +0100 |
---|---|---|
committer | PanFritz <redstonenoobpan@gmail.com> | 2015-01-17 14:33:49 +0100 |
commit | 60181bd65792c8413331bd28a37ccd1cb2fe8d21 (patch) | |
tree | 386761ee2632fbe97554defd5056d646cd51d20e /calc.py | |
parent | 9b4d73cfe27d3348e7f34dabda20ca0c70867b20 (diff) |
Removed . from operators, remade line 17
Diffstat (limited to 'calc.py')
-rw-r--r-- | calc.py | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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 |