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

implemented num args check

parent 09104d70
Branches main
No related tags found
No related merge requests found
No preview for this file type
...@@ -14,7 +14,8 @@ def calculate(arg): ...@@ -14,7 +14,8 @@ def calculate(arg):
elif token == '-': elif token == '-':
result = val1 - val2 result = val1 - val2
stack.append(result) stack.append(result)
if len(stack) > 1:
raise ValueError("too many arguments on the stack")
return stack[0] 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