Feature description
As mentioned in #8724, we have two files for evaluating postfix expressions. But currently both of them only work with binary operators and will raise an exception when an unary operator is given.
example:
>>>res=evaluate_postfix(["2", "-", "3", "+"])
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File".../stacks/evaluate_postfix_notations.py", line31, inevaluate_postfixb, a=stack.pop(), stack.pop()
IndexError: popfromemptylist>>>
2-3+ is a postfix notation for -2+3 infix and should result in 1.
Feature description
As mentioned in #8724, we have two files for evaluating postfix expressions. But currently both of them only work with binary operators and will raise an exception when an unary operator is given.
example:
2-3+is a postfix notation for-2+3infix and should result in1.