GoalScope — evaluate_rpn (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def evaluate_rpn(tokens):↵
"""Evaluate the value of an arithmetic expression in Reverse Polish Notation."""↵
stack = []↵
for token in tokens:↵
if token.isdigit() or (token[0] == '-' and token[1:].isdigit()):↵
stack.append(int(token))↵
else:↵
b = stack.pop()↵
a = stack.pop()↵
if token == '+':↵
stack.append(a + b)↵
elif token == '-':↵
stack.append(a - b)↵
elif token == '*':↵
stack.append(a * b)↵
elif token == '/':↵
stack.append(int(a / b))↵
return stack[0]↵
</code>