Question
[PYTHON] - POSTFIX EXPRESSIONS The stack function I have already completed and inserted into the code. It works from previous lab so assuming it should
[PYTHON] - POSTFIX EXPRESSIONS
The stack function I have already completed and inserted into the code. It works from previous lab so assuming it should work here as well.
I need help with the postfix expression. thank you for your time Using your Stack implementation from Lab#10, write the function posfir(expression), where expression is the string of a postfix expression. The function returns the value after evaluating such expression. Function notes Expression Operators: + -,/, *,A (a b is a to the power b) The postfix expression is a string of operands and operators delimited by spaces - EXAMPLE >>> postfix ( "4 7 6 * + 10 -'*) # Infix: 4+7*6-10 36 >>> postfix ("2 4 ^ 3 + 2 5 / -") # Infix: (2-4) +3-2/5 18.6 >>> postfix ("16 42 3 _ - 7 + 5 *") # Infix: (16-(42-3)+7)*5 -80 >>> postfix ("10 5 / 2 +") # Infix: (10/51+2 # Depending on your implementation, 4.0 is also a correct answer Tips Go to http://www.mathblog.dk/tools/infix-postfix-converter/ to create your test cases
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started