On Tue, Jun 26, 2012 at 4:52 PM, Sithembewena Lloyd Dube <zebr...@gmail.com>wrote:
> HI, > > Would anyone have tips on how to generate random 4-digit alphanumeric > codes in python? Also, how does one calculate the number of possible > combinations? > > Thanks in advance. > > Python's, random module is your friend. I'd suggest looking at the random.choice() function. As for the number of possibilities, if your codes are not case sensitive, you'll have 10 + 26 = 36 possibilities for each character/digit. 4 digits, so 36**4 possible codes. Hugo
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor