Infix to Postfix conversion using stack in Python?

I’ve learnt the concept of infix to postfix and now I can do by hand infix to postfix conversion. Now, I want to write code in Python for it.

First I need to know, how do I read values from left to right in Python?

Then, I need to know, how to check if the string is left paranthesis, operand, operator or right paranthesis in Python. Other than that, I can write it.

When you say “read values”, are you asking about how to read characters from a string?


How familiar are you with Python? This article describes some operations that can help you out: How to Parse a String in Python – Parsing Strings Explained

Once you read a value, you can then check if the value equals another character like “(” or “+” or equivalent to start building up your pattern matching logic.