We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 838d8f2 commit 1695641Copy full SHA for 1695641
final_task/pycalc/calc.py
@@ -148,7 +148,8 @@ def correct_expression(expression):
148
elif expression == '':
149
raise CalcError('ERROR: empty expression')
150
expression = insert_multiplication(match_negative_value(fix_missing_zero(fix_multi_operations(expression))))
151
- regex = re.compile(r'(<=|==|!=|>=|e|pi|tau|inf|nan|log1p|^-\d+\.\d+|^-\d+|(?<=\W\W)\-\d+\.\d+|(?<=\W\W)\-\d+|'
+ regex = re.compile(r'(<=|==|!=|>=|(?<=[^a-z])e|e|pi|tau|inf|nan|log1p|^-\d+\.\d+|^-\d+|(?<=\W\W)\-\d+\.\d+|'
152
+ r'(?<=\W\W)\-\d+|'
153
r'(?<=\()\-\d+\.\d+|(?<=\()\-\d+|(?<=[a-z]\W)\-\d+\.\d+|(?<=[a-z]\W)\-\d+|(?<=\))\-|'
154
r'\//|\/|\d+\.\d+|\d+|\W|\w+)')
155
re_expr = re.split(regex, expression)
0 commit comments