Question: Python question: Expected to write a program that calculates infix arithmetic expressions by converting them into postfix via python .In your homework, your program is

Python question:

Expected to write a program that calculates "infix" arithmetic expressions by converting them into "postfix" via python .In your homework, your program is expected to receive an infix statement as a command line parameter. For the parameters that your program will accept, only: four operation operators + * - / (conventional priorities can be used for operators: * / equal and higher priority + - equal and lower priority, equal priorities are calculated from left to right) and only positive integers (can be multiple digits) ) will take place.

Your program will follow briefly below: An icon (operator, number) in the received infix parameter will be parsed and kept in an array. Infix expression will be converted to a stack available postfix, and each symbol in the postfix expression will be sequentially thrown into a queue (tail).A stack will be calculated by pulling from the queue before it is inexhaustible.The result will be written on the command line and the program will be terminated.

Input

3+2*20/5

Output

Postfix version and result such as

Postfix equals to 3 2 20*5/+ and result 11

Thanx

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem you will need to write a Python program that converts an infix arithmetic expr... View full answer

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!