[Tutor] for loop

Alan Gauld alan.gauld at btinternet.com
Thu Apr 16 23:31:19 CEST 2009


"mbikinyi brat" <mbikinyi_brat at yahoo.com> wrote 

>  Then I thought letter should be a special word in python. 

Why did you think that?
Python has a very specific (and small) set of keywords that have 
special meaning - things like for, while and print

But you can call variables pretty much whatever you like and 
Python will be happy. In fact the more meaningful the better, 
so letter is a very good choice.

> Then I now replace letter whith chic and yet the same results 
> is obtained. 


Current letter: p
Current letter: y

chic: p
chic: y

They are not the same results, one says 'letter' and the other 
says 'chic', just as you told it to. In every other respect your 
code is identical so the output is identical. Python just does 
what you tell it to, it is not actually intelligent, it just interprets 
the commands you give it.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list