Question: Python - postfix (you can use stack, array, queue ) Question 1: Implement an interpreter-like postfix calculator. Your program should repeatedly: Print a prompt to
Python - postfix (you can use stack, array, queue )


Question 1: Implement an interpreter-like postfix calculator. Your program should repeatedly: Print a prompt to the user. The prompt should be:-> Read an expression from the user Evaluate that expression Print the result Your calculator should support 2 kinds of expressions: 1. Arithmetic expressions-are given in postfix notation. The tokens of the expression are separated by a space. 2. Assignment expressions- are expression of the form variable-name = arithmetic-expression When evaluated, it first evaluates the arithmetic_expression (given in postfix notation), and then it associates that value with variable_name (in a data structure of your choice) Notes: The value of an assignment expression, is the name of the variable being assigned . Assume that the variable_name, the 'symbol, and the arithmetic expression are separated by a space. Question 1: Implement an interpreter-like postfix calculator. Your program should repeatedly: Print a prompt to the user. The prompt should be:-> Read an expression from the user Evaluate that expression Print the result Your calculator should support 2 kinds of expressions: 1. Arithmetic expressions-are given in postfix notation. The tokens of the expression are separated by a space. 2. Assignment expressions- are expression of the form variable-name = arithmetic-expression When evaluated, it first evaluates the arithmetic_expression (given in postfix notation), and then it associates that value with variable_name (in a data structure of your choice) Notes: The value of an assignment expression, is the name of the variable being assigned . Assume that the variable_name, the 'symbol, and the arithmetic expression are separated by a space
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
