[Tutor] %d

Patrick Kirk patrick@kirks.net
Tue, 22 May 2001 21:58:17 +0100


In Alan Gauld's tutorial page 2 you suddenly move from gentle hand holding
to this:

>>>print "The sum of %d and %d is: %d" % (v,w,x)

v,w,x are variables and have integer values.  d is less clear.  And %?

I thought % was for the modulus function.  So what is that % doing in front
of d which I assume to be a built in variable?  And what is the % in front
of the curly brackets?

I generally keep going when I don't understand and the answer normally comes
from the context.

I've carried on through Alan's explanation of "for" and "while".  This is
easy to use and I need never memorise my 29 times tables but what is the %
before the curly brackets?  I'm in the position that I can do the
calculation but not clear on why I use this syntax until I understand that
%.

Sorry if this is a little less challenging than interfaces to
Postgres...give me another couple of weeks for that :-()  Meanwhile please
point me in the right direction.
--
Patrick Kirk
GSM: +44 7712 184 480
ICQ: 42219699