[Tutor] for loop

Emile van Sebille emile at fenx.com
Thu Apr 16 22:53:32 CEST 2009


mbikinyi brat wrote:
> Dear ALL,
> I am a beginner in python and I just copied the code in blue below and 
> execute and had the result in green. Then I thought *letter* should be a 
> special word in python. Then I now replace letter whith *chic*  and yet 
> the same results is obtained. 

of course -- changing the name of the variable used to hold results 
shouldn't change the outcome.

I cannot reconcile them. Can someone
> explained to me please?

If you expect something different, then you need to write a different 
program.  What did you want to happen?

Emile


> *>>> for letter in "python":
>  print "Current letter:", letter*
>  
> *Current letter: p
> Current letter: y
> Current letter: t
> Current letter: h
> Current letter: o*
> *Current letter: n*
> ** 
> *>>> for chic in "python":
>  print "chic:", chic*
> * 
> chic: p
> chic: y
> chic: t
> chic: h
> chic: o
> chic: n*
> *
>  *
> * *
> *Regards,*
> *Henry*
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list