Last active
March 30, 2016 12:49
-
-
Save zigzackey/4d003d45547b3f95971d3a594f83b133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ope = {"+": lambda a, b: b + a, | |
"-": lambda a, b: b - a, | |
"*": lambda a, b: b * a} | |
stack = [] | |
for c in input().split(): | |
if c in ope: | |
stack.append(ope[c](stack.pop(), stack.pop())) | |
else: | |
stack.append(int(c)) | |
print(stack[-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment