summaryrefslogtreecommitdiff
path: root/calc.py
diff options
context:
space:
mode:
authorPanFritz <redstonenoobpan@gmail.com>2015-01-17 14:03:20 +0100
committerPanFritz <redstonenoobpan@gmail.com>2015-01-17 14:03:20 +0100
commit9b4d73cfe27d3348e7f34dabda20ca0c70867b20 (patch)
tree49bc1c15033270443b2995ed25aae8d3a3670a48 /calc.py
parentc1a69c6a62167ebf7eaf3b20d0804b5d0e12881f (diff)
Added check for .
Diffstat (limited to 'calc.py')
-rw-r--r--calc.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/calc.py b/calc.py
index 457ce9d..ccecba4 100644
--- a/calc.py
+++ b/calc.py
@@ -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