[Tutor] Simple RPN calculator

Liam Clarke cyresse at gmail.com
Sun Dec 5 06:31:50 CET 2004


RPN calculator, with operators and operands separate? Sounds
counter-intuitive to me.
What's the advantage I'm missing?

P.S.

Nice Shodan quote Max ;)


On Sat, 4 Dec 2004 23:45:18 +0000, Max Noel <maxnoel_fr at yahoo.fr> wrote:
> 
> 
> 
> On Dec 4, 2004, at 23:30, Alan Gauld wrote:
> 
> >> 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?...
> 
>         Nope, RPN calculators (such as the HP48GX, IMHO the best calculator
> ever made) require you to input the operands first, then the operators.
> It's both easier to implement and more intuitive (not to mention way
> faster to both input and compute) once you've gotten the hang of it.
>         You can probably do a very basic RPN calculator in less than a hundred
> lines of code, using raw_input() and a stack (well, a list's append()
> and pop() methods).
> 
> -- Max
> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> "Look at you hacker... A pathetic creature of meat and bone, panting
> and sweating as you run through my corridors... How can you challenge a
> perfect, immortal machine?"
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list