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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to