[Tutor] Simple RPN calculator

Alan Gauld alan.gauld at freenet.co.uk
Sun Dec 5 00:30:55 CET 2004


> I am new to programming and so don't know "anything" much, yet.
> I am having problem with implementing a simple RPN calculator
> in python.

I'm not surprised. While an RPN vcalculator is one of the easier
calculators to build its not exactly trivial. It sounds like the
kind of thing an ambitious (or optimistic?) teacher might set
for homework... Would I nbe right?

> to make it request for input(s) of say a simple math like  "1 2 3 4
5 + - * /".

Look at raw_input()

But if you are that much of a beginner you need to take several
steps back and try one of the tutorials, they all cover raw_input
fairly early on...

And finally doesn't RPN put the operators first? Or is it me thats
getting confused fromtoo much Lisping recently?...

> Help please with any suggestions or any other better and easier
> way of implementing a RPN calculator.

Python is a fine place to start building RPN calculators. But thee
are so many available that I van't help suspecting homewoprk here,
and we can only offer limited guidance in that case.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list