#----------------------------------------------------------------------- # LoadedDice.py # # Simulates n rolls of 2 loaded 6-sided dice. Determines the probability # that the sum of the two dice is equal to 3. # #----------------------------------------------------------------------- from random import randint, random n = 1_000_000 # of rolls sum_eq_3_freq = 0 # number of times the sum is divisible by 3 sum = 0 # sum of two dice # dictionary: P[k]=probability of face k (1<=k<=6) P = {1:.12, 2:.14, 3:.17, 4:.20, 5:.19, 6:.18} # perform all trials for i in range(n): # throw first die x = random() # get a random number in [0.0, 1.0) die_1 = 1 if x