1

In [1]:

import numpy as np

2

In [2]:

def repeating_numbers(): n=np.random.randint(2,16,size=1) # making "n" between 2-15,since the number of people rolling the die is 2-15 die_roll =np.random.randint(1,21,size=n) # number on die with n amount of times unique_values=[] for value in die_roll: if value not in unique_values: unique_values.append(value) if len(unique_values) ==n: # if total number is less than n then it means that at least 2 people rolled the same number return 0 # if n is exactly n than it mean each people rolled a different number else: return 1

3

In [3]:

sum([repeating_numbers() for i in range(1000)])/1000 # calculating the probabilty by adding up all the ones in the trials and divide it by the total amount of trials (in this case 1000 trials)

4

0.694

5

In [ ]:

6