samedi 30 janvier 2016

Code to generate random winner

I'm making this program that lets a user choose how raffle entries they want in a draw.Im stuck on choosing a winner does anyone know a code that selects random winner here's my code so far and also Python can't generate many as millions as it crashes between 2k is there a way you can exceed that thanks.

import random 

def genNumber(n = 4):
    return "".join([str(random.randint(0,9)) for i in range(n)])


for i in range(6666):
    word = random.choice(['blue', 'aqua', 'jade','plum', 'gold', 'navy', 'pink', 'grey', 'ruby', 'rose', 'teal',"lime",]) 
    print("{} {} {}".format(word.title(), genNumber(4), genNumber(4)))
random.choice(word)




Aucun commentaire:

Enregistrer un commentaire