[Tutor] Problem with while loop

matte mailinglistmatt at gmail.com
Fri Sep 7 13:41:43 CEST 2007


Hi guys

Please excuse me but I've been out of Python for a while since my laptop was
stolen...

I'm battling with a very basic while loop....

-------------- 8< ----------------------
#!/usr/bin/python

from random import randint

counter = 0

howmany = raw_input( "How many: " )

while counter < howmany:

    pin = randint(0000,9999)
    print pin
    counter += 1

-------------- 8< ----------------------

For some reason if I use an integer in place of "howmany" it works, but I'd
like it to work as I can logically see it above.

What am I missing ?

-m
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070907/a8faff46/attachment.htm 


More information about the Tutor mailing list