> Now I just need to figure out how to only get 4 digit pin numbers :)
>
Use regular expressions....
The following is the code with re.


from random import randint
import re

counter = 0
pinPattern = re.compile(r'^\d{4}$')
howmany = raw_input( "How many: " )
if pinPattern.match(howmany):
    while counter < int(howmany):
        pin = randint(0000,9999)
        print pin
        counter += 1
else:
    print "%s is not valid 4 digit integer"%howmany


-vishnuMohan
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to