I am trying to write a mock lottery simulator as a thought excercize and for some introductory python practice, where each team would have 2x the odds of getting the first pick as the team that preceded them in the standings. The code below works (although I am sure there is a more efficient way to write it), but now I would like to figure out a way to find each individual teams odds of getting a certain draft spot based on their odds. I believe there are 12! ways for the order to be set, so it would be next to impossible to compute by hand. Is there a way to run a simulation in python (say 10 million times) and see what percentage of those times each team ends up in a certain spot of the shuffled list?
import random
from time import sleep
first = [1*['team 1']]
second = [2*['team 2']]
third = [4*['team 3']]
fourth = [8*['team 4']]
fifth = [16*['team 5']]
sixth = [32*['team 6']]
seventh = [64*['team 7']]
eighth = [128*['team 8']]
ninth = [256*['team 9']]
tenth = [512*['team 10']]
eleventh = [1024*['team 11']]
twelfth = [2048*['team 12']]
total = []
for i in first:
for x in i:
total.append(x)
for i in second:
for x in i:
total.append(x)
for i in third:
for x in i:
total.append(x)
for i in fourth:
for x in i:
total.append(x)
for i in fifth:
for x in i:
total.append(x)
for i in sixth:
for x in i:
total.append(x)
for i in seventh:
for x in i:
total.append(x)
for i in eighth:
for x in i:
total.append(x)
for i in ninth:
for x in i:
total.append(x)
for i in tenth:
for x in i:
total.append(x)
for i in eleventh:
for x in i:
total.append(x)
for i in twelfth:
for x in i:
total.append(x)
random.shuffle(total)
order = []
for i in total:
if i not in order:
order.append(i)
print('the twelfth pick goes to {}'.format(order[11]))
sleep(1)
print('the eleventh pick goes to {}'.format(order[10]))
sleep(1)
print('the tenth pick goes to {}'.format(order[9]))
sleep(1)
print('the ninth pick goes to {}'.format(order[8]))
sleep(1)
print('the eighth pick goes to {}'.format(order[7]))
sleep(1)
print('the seventh pick goes to {}'.format(order[6]))
sleep(2)
print('the sixth pick goes to {}'.format(order[5]))
sleep(2)
print('the fifth pick goes to {}'.format(order[4]))
sleep(2)
print('the fourth pick goes to {}'.format(order[3]))
sleep(3)
print('the third pick goes to {}'.format(order[2]))
sleep(3)
print('the second pick goes to {}'.format(order[1]))
sleep(3)
print('the first pick goes to {}'.format(order[0]))