samedi 30 janvier 2016

Code to randomly select raffle & generate millions

I'm currently making this program that allows a user generate as many raffles as they need to put into the draw.the bit I'm stuck on is finding a code that randomly select raffle winner from all generated raffles.And also do any of you know if it's possible that Python can generate millions as it crashes at 2k.Heres my code so far 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)

PLEASE TEST THE PROGRAM




Aucun commentaire:

Enregistrer un commentaire