Question: Use Python (python 3.6.2) to create a simple calculator that accepts Reverse Polish Notation (RPN) and displays the final answer (Intermediate steps or results need

Use Python (python 3.6.2) to create a simple calculator that accepts Reverse Polish Notation (RPN) and displays the final answer (Intermediate steps or results need not be displayed). It only accepts 4 operators +, -, *, /. You should convert the algebraic notation to RPN before using it as input to your program. The input will be provided in a text file called input_RPN.txt. There will be one RPN expression in each line. Your code should be able to read in the file and print the result for each RPN in a new line. Example of RPN: - If you want to compute the answer for the algebraic notation 4 + 2 , your RPN will be 4 2 + and your output should be 6. This is a simple expression. More complex algebraic notations will be used to test your program like the one below. Example algebraic notation: ( 4 + 2 * 5 ) / ( 1 + 3 * 2 ) Translated into RPN: 4 2 5 * + 1 3 2 * + /

Your code will take in an algebraic expression and convert it to RPN and evaluate the RPN. Print the RPN and the result in separate lines

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!