Super Lemonade Factory competitions

We’re going to be giving away some Super Lemonade Factory related merchandise soon, and to pick winners we’re going to use this piece of Python code.

If you can’t follow the code, it basically means the earlier you enter, the better your chance of winning.

import random as rn
import numpy as np
#set the total number of correct entries.
totalCorrectEntries = 201
correctEntrySets = totalCorrectEntries/4.0
pool = [correctEntrySets, correctEntrySets, correctEntrySets, correctEntrySets,
 correctEntrySets*2, correctEntrySets*2, correctEntrySets*2,
 correctEntrySets*3, correctEntrySets*3,
 correctEntrySets*4]
randIndex = rn.uniform(0,len(pool))
randPoolWinner = rn.uniform(0,int(correctEntrySets))
winner = pool[int(randIndex)] - randPoolWinner
print "Winner is entry number:", int(winner+1)

Comments are closed.