[Tutor] Income calculator

Boykie Mackay boykie.mackay at gmail.com
Thu Sep 20 12:56:19 CEST 2007


I have tried the code and it does give a syntax error.Another lesson for
me I guess.I should test code before posting,unless I'm sure of my post.

The problem was with the brackets in lines 17/18.I got the code running
but I don't think the 'quit' function works as it should.

Being a novice I think it would be something for me to come back to
later.
On Thu, 2007-09-20 at 08:50 +0100, Alan Gauld wrote:
> "Boykie Mackay" <boykie.mackay at gmail.com> wrote
> 
> > doesn't seem to be properly formatted.There should be a comma after 
> > the
> > closing quotation marks,a closing bracket after the first variable 
> > and a
> > % sign before the next i.e:
> >
> >> print "Your expected earnings for %s is %d", 
> >> %(financeLogs['month']),%
> >> financeLogs['total'])
> >
> > Hope above works!
> 
> Nope, this is wrong. The OP had it correct.
> String formatting has a string followed by a % followed by a tuple of 
> values.
> Did you actually try executing the line of code you posted? What 
> happened?
> 
> Alan G. 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list