classSolution: defevalRPN(self, tokens: List[str]) -> int: num = [] for i in tokens: if i != '+'and i != '-'and i != '*'and i != '/': num.append(int(i)) else: a = num[-1] num.pop() b = num[-1] num.pop() if i == '+': num.append(a + b) elif i == '-': num.append(b - a) elif i == '/': num.append(int(b / a)) elif i == '*': num.append(a * b) return num[-1]