diff options
author | PanFritz <redstonenoobpan@gmail.com> | 2015-01-17 14:03:20 +0100 |
---|---|---|
committer | PanFritz <redstonenoobpan@gmail.com> | 2015-01-17 14:03:20 +0100 |
commit | 9b4d73cfe27d3348e7f34dabda20ca0c70867b20 (patch) | |
tree | 49bc1c15033270443b2995ed25aae8d3a3670a48 /calc.py | |
parent | c1a69c6a62167ebf7eaf3b20d0804b5d0e12881f (diff) |
Added check for .
Diffstat (limited to 'calc.py')
-rw-r--r-- | calc.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,7 +1,7 @@ from helpers import * calc_users = open_json_file("calc", []) -math_operators = ["+", "-", "*", "/", "&", "|",".",] +math_operators = ["+", "-", "*", "/", "&", "|"] ignore_operators = ["**", "&&", "||"] # ** may be too intensive, the others cause syntax errors calc_perm = "utils.calc" @@ -16,6 +16,8 @@ def calc(text): for char in text: if char.isdigit() or (should_calc and char in [".", " "]): expression += char + elif expression and char == ".": + expression += char elif char in math_operators: # calculation must include at least 1 operator should_calc = True |