[Tutor] Income calculator

Boykie Mackay boykie.mackay at gmail.com
Thu Sep 20 09:37:21 CEST 2007


I don't know if it's any help,but the line mentioned in the error
message;

File "./pyfinances.py", line 18
>            print "Your expected earnings for %s is %d" %
>         (financeLogs['month'], 
>         financeLogs['total'])
>                ^

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!





On Thu, 2007-09-20 at 11:22 +1200, Ian Witham wrote:
> Your links aren't working for me.
> 
> On 9/20/07, Ulrich Holtzhausen <ulrich at lavabit.com> wrote:
>         Hi there,
>         
>         I started out with Python about two days ago, it's my very
>         first shot at
>         programming and I find it quite interesting. Anyway I'll get
>         to the point:
>         
>         I made a simple script that works, albeit not the shortest way
>         I think 
>         but it works, however I would like to make it a bit more
>         "fancy" though
>         I'm getting an error. Below is my first script that works, the
>         second
>         script doesn't work, the error I get on the second script is
>         simple, but 
>         I can't seem to figure out how to fix it, also, if there's a
>         shorter way
>         of doing this effectively, please help :) .
>         
>         File "./pyfinances.py", line 18
>            print "Your expected earnings for %s is %d" %
>         (financeLogs['month'], 
>         financeLogs['total'])
>                ^
>         SyntaxError: invalid syntax
>         
>         Basic working program: http://pastebin.com/f2f7f3cd5
>         Non-working program: http://pastebin.com/f4da62e57
>         
>         Thanks in advance for any help contributed.
>         
>         _______________________________________________
>         Tutor maillist  -  Tutor at python.org
>         http://mail.python.org/mailman/listinfo/tutor
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list