[Tutor] Beginner-->conditional statements

alan.gauld@bt.com alan.gauld@bt.com
Wed, 28 Aug 2002 18:01:05 +0100


> I went to your website and read a good part of your tutorial.
> I had a question about the usage of '%' for MOD and then
> its apparent different meaning in the next contiguous section.

You are right it is contradictory. There are two unrelated usages 
of %. IMHO Its one of the bad things in Pythons design and I 
deliberately put the two uses on the same page to emphasise 
that it is different. If I'd separated them the new use 
might have just masked the earlier one and it would have 
been lost. Maybe I haven't emphasised that they are 2 completely 
different things enough...

> However, my post to you from your website bounced as spam!

If that was a week or two back my ISP decided to kill my 
account for some reason! It should be OK now.
The correct email for tutorial issues is:

alan.gauld@btinternet.com

> The difference is between: a and alan; crosswinds/net;  and bt/com

bt.com is work. btinternet.com is home (where the tutor master 
files live) and crosswinds.net is obsolete - I get 20-30 junk 
mails a day on it...

Now for something completely different...
> So by etc. does that include SF Fisherman's Wharf and Wax Museum?

Thanks everyone for SF suggestions. More are still welcome.


> >>> print 7%4
> 3
> 
> >>> print "The sum of %d and %d is: %d" % (7,18,7+18)
> {SH: This seems like a new usage? I'm not sure how to evaluate it?

It is a new usage, you are right.

> In this command the format string contains '%' markers within 
> it. The letter 'd' after the % tells Python that a 
> 'decimal number' should be placed there.

I'll change the wording to include a specific caveat that 
it is unrelated to the modulo operator above. 
Thanks for pointing that out.

Next question? :-)

Alan g.