On Sun, Aug 2, 2015 at 9:39 AM, Quiles, Stephanie <stephanie.quiles...@albright.edu> wrote: > > hello again! > > I have to unify these methods so that i can enter an infix, convert it to a > postfix and then solve. Here are the methods
At the end of your code I added this - inFixExpr = raw_input("Enter infix string : ") postFixExpr = infixToPostfix(inFixExpr) print("The postfix string is: " + postFixExpr) value = postfixEval(postFixExpr) print("The final result is: " + str(value)) And this gives me output - $ python postfix.py 5 3 4 2 - ^ * A B + C * D E - F G + * - Enter infix string : ( 8 + 2 ) * ( 2 + 4 ) The postfix string is: 8 2 + 2 4 + * The final result is: 60 > if token in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" or token in "0123456789": Instead of the above line, you can do this - if token in string.uppercase or token in string.digits: Import string module first. >>> import string >>> string.uppercase 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' >>> string.digits '0123456789' >>> Thanks, Anish _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor