 CoCalc Public FilesFinal_Projects_F20 / Burnside_Russo_2.ipynb
Views : 211
Compute Environment: Ubuntu 20.04 (Default)

# Big Wheel Numbers

Determine the chances of getting between a 0.85 and a 1.00 in two spins on The Price is Right Big Wheel game.

The Big Wheel contains 20 values in 5 cent increments ranging from 5 to 100. The contestant can spin the wheel twice, and the value of each spin is added to their total price money amount.

To determine to chances of getting a sum between 85 cents and 1.00 dollar with two spins, we can implement a function to generate all possible combinations of values and from there find the number of ways to obtain a total value of 0.85, 0.9, 0.95, or 1.00.

In [ ]:
import numpy as np

values=[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100] #20 possible spin values on the big wheel

spinCombinations=[[spin1,spin2] for spin1 in values for spin2 in values] # all possible combinations of spins

SpinSum=[[spin1+spin2] for spin1 in values for spin2 in values] #all possible sums of two spins

SpinStreak=0

for i in range(len(SpinSum)): #evaluates combined sum of all combinations of two spins
for Spins in SpinSum[i]:
if (Spins>=85 and Spins<=100):
print(spinCombinations[i], '=', SpinSum[i], 'cents')
SpinStreak+=1 #if sum is between 85 and 100 then the spinStreak is appended

print('Total number of combinations >=85 and <=100: ', SpinStreak)

print('Total number of combinations >=85 and <=100 divided by all possible sums of two spins: ', SpinStreak, '/', len(SpinSum), '=', (SpinStreak/len(SpinSum))*100, '%')


There are 400 different combinations of numbers that can be obtained by with two spins of The Big Wheel.

There are 70 different combinations of numbers that the sum of their values is between 85 cents and 1.00 dollar.

The probability is the total combinations of sum between 85 cents and 1.00 divided by all total combinations of values., which is 70/400 or 17.5%.

### Big Wheel Simulator

The simulation below has two functions:

twoSpins() generates two random integers between 5 and 100 by increments of 5 which will define the values of our two spins. It then returns the combined sum of the two spin.

BetweenEightFiveAndOneHundred() evaluates the value returned by twoSpins(). If the value is between our required combined sum of greater than 85 or less than 100, it returns a value of 1. If not, it returns a value of 0.

The array spinStreakSum stores the values return by the BetweenEightFiveAndOneHundred() function. By iterating the function a large number of times, spinStreakSum will repeatedly appended to store all the returned values of our BetweenEightFiveAndOneHundred() function.

The sum of spinStreakSum is the sum of all values of 1 in the array. By taking the sum of spinStreakSum and diving it by its length, we get a mean value which, when multiplied by 100, gives us the percentage probability of obtaining a combined sum greater than 85 or less than 100 over the period of a large number of spins.

In :
import random

spinStreakSum=[] #empty array to fill with 0 or 1 values

def twoSpins(): #function to generate to random spins between 5 and 100 and returns combined sum
Spin1=random.randrange(5, 101, 5)
Spin2=random.randrange(5, 101, 5)
SpinTotal=Spin1+Spin2
return SpinTotal

def BetweenEightyFiveAndOneHundred(): #function evaluates the total in twoSpins() and returns 1 if spinTotal is >=85 or <=100
spinTotal=twoSpins()
if (spinTotal>=85 and spinTotal<=100):
return 1
else:
return 0

for i in range(100000): # large number of iterations to fill the spinStreakSum array to obtain an accurate estimate
spinStreakSum.append(BetweenEightyFiveAndOneHundred())

print('probability of obtaining a sum greater than 85 cents or less than 1.00 dollar:')
print(sum(spinStreakSum), '/', len(spinStreakSum), '=', (sum(spinStreakSum)/len(spinStreakSum))*100, '%')

probability of obtaining a sum greater than 85 cents or less than 1.00 dollar: 17405 / 100000 = 17.405 %

### Conclusion

The Big Wheel Simulator supports the statistical probability determined in our first function of approximately 17.5%