On 28/07/15 20:08, Quiles, Stephanie wrote:

Hoi Stephanie,

Please start a new topic on a new thread/subject.
It makes funding stuff in the archives much easier.


...if someone could please make it a little easier to figure out postfix and 
infix?
> My homework assignment asks me to convert from infix to postfix. ...
Here is an example A+B/C*D-E+F

I thought it was something like ABC/+ cd*ef+-??


If I work this back correctly it translates as:

(A+B/C)  (C*D)-(E+F)

which seems to miss an operation? It also uses C twice.

The first thing you need to do it work out how to put parens
on the original to express the precedence precisely. Then
the postfix format should pretty much drop out.

Do you have access to an RPN calculator(emulator)?
That will help you test it. If on *nix try xcalc -rpn

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to