Nested structures question
Jean-Michel Pichavant
jeanmichel at sequans.com
Thu Jan 13 06:13:02 EST 2011
Physics Python wrote:
> Hello,
>
> I am teaching myself python using the book: Python Programming for Absolute Beginners, 2nd edition by Michael Dawson. I am using python 2.7.1.
>
> In chapter 3 we are learning to use structures (while, if, elif) to write a program that has the user guess a number between 1 and 100.
>
> Here is the code for the baseline program:
>
>
[snip]
here is an example of code using a for loop, which is always better than
a while loop, when applicable of course.
It uses the for... else... statement which is rather strange at first
glance but has some uses, it's always good to know it exists.
http://paste.pocoo.org/show/319931/
JM
More information about the Python-list
mailing list