☑Kizspy.me
(Choose 1 answer)
☐ A
Back
Next
FUQ.sh
sh the exam.
Consider the following function:
def fn(expression):
stack=
for char in expression:
if char.isdigit():
stack.append(int(char))
else:
b = stack.pop()
a = stack.pop()
if char == '+':
stack.append(a + b)
elif char == '-
stack.append(a - b)
elif char == '*'.
stack.append(a*b)
elif char == '/':
stack.append(a // b)
return stack.pop()
What is the output of the function for the input string "231*+9-"?
A. -4
B. 4.
C. -12
D. 12