Evaluate Reverse Polish Notation LeetCode solution in Python
1class Solution:2def evalRPN(self, tokens: List[str]) -> int:3stack = []4for i in tokens:5if i == "+":6stack[-1] = stack[-2] + stack.pop()7elif i == "-":8stack[-1] = stack[-2] - stack.pop()9elif i == "*":10stack[-1] = stack[-2] * stack.pop()11elif i == "/":12stack[-1] = int(stack[-2] / stack.pop())13else:14stack.append(int(i))1516return stack.pop()