Skip to content
Snippets Groups Projects
Commit d34d6b0d authored by ehcole's avatar ehcole
Browse files

edited rpn.py

parent e31fc16f
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -7,12 +7,12 @@ def calculate(arg):
try:
stack.append(int(token))
except ValueError:
val1 = stack.pop()
val2 = stack.pop()
val1 = stack.pop()
if token == '+':
result = val1 + val2
elif token == '-':
result = val2 - val1
result = val1 - val2
stack.append(result)
return stack[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment