The casino has an interesting new game.
You start with a bankroll of $100 and place a $1 bet on a number 1 through 6. You then roll three dice, and if any of the dice rolls match your original bet, you win the number of matching dice ($1, $2, or $3), plus your original $1 bet back. If you lose, your bankroll goes down $1. You must play the game 100 times, and you keep the sum of your bankroll at the end of the 100 dice rolls.
What are the odds of winning?
Taking the bet is a personal choice, but the odds are not in the bettor’s favor, as you have more to lose than possibly gain.
On average, you will lose $8 dollars, but you could lose up to $50 dollars, or possibly gain $36 dollars.
import random import numpy as np import matplotlib.pyplot as plt result =  for _ in range(10_000): # start with 100 dollars i = 100 win = 0 for _ in range(100): bet = random.randint(0,5) diceroll = np.random.choice(6, 3, replace=True) # you can win 1,2 or 3 points for x in diceroll: if bet == x: win = 1 i += 1 # bettor gets their original point ba, or loses their bet if win == 0: i -= 1 win = 0 result.append(i) over100 = 0 for j in result: if j > 100: over100 += 1 print('The average is ' + str(sum(result)/len(result))) print('The percentage over 100 is ' + str(over100/10_000)) print('The min result is ' + str(min(result))) print('The max result is ' + str(max(result))) plt.hist(result,bins=20) plt.xlabel('Amount') plt.ylabel('Count') plt.show()