Commented unecessary print statements

master
Aadhavan Srinivasan 1 year ago
parent 516e917086
commit 716dbac01f

@ -119,13 +119,13 @@ def evaluate(subexpr): # Evaluate a tokenized expression, that contains no paran
subexpr = [element for element in subexpr if element != ''] # Remove empty characters in the expression subexpr = [element for element in subexpr if element != ''] # Remove empty characters in the expression
print(subexpr) # print(subexpr)
for index, val in enumerate(subexpr): # Replace variables with their values for index, val in enumerate(subexpr): # Replace variables with their values
if str(val).isalpha(): if str(val).isalpha():
subexpr[index] = variables[val] subexpr[index] = variables[val]
print(subexpr) # print(subexpr)
if (len(subexpr) == 1): if (len(subexpr) == 1):
return float(subexpr[0]) return float(subexpr[0])
@ -152,12 +152,12 @@ def evaluate(subexpr): # Evaluate a tokenized expression, that contains no paran
subexpr[index-1] = '' subexpr[index-1] = ''
subexpr[index+1] = '' subexpr[index+1] = ''
print(subexpr) # print(subexpr)
return evaluate(subexpr) return evaluate(subexpr)
def find_inner(subexpr): def find_inner(subexpr):
print("expr: " + subexpr) # print("expr: " + subexpr)
subexpr = parse(subexpr) subexpr = parse(subexpr)
@ -167,7 +167,7 @@ def find_inner(subexpr):
subexpr_string = ''.join(subexpr) subexpr_string = ''.join(subexpr)
print("New expr: " + subexpr_string) # print("New expr: " + subexpr_string)
if not '(' in subexpr_string and not ')' in subexpr_string: if not '(' in subexpr_string and not ')' in subexpr_string:
return str(evaluate(subexpr)) return str(evaluate(subexpr))
@ -197,6 +197,7 @@ def main():
expr = find_inner(expr) expr = find_inner(expr)
print(expr) print(expr)
if (len(variables) > 0):
print(variables) print(variables)
main() main()

Loading…
Cancel
Save