Question: using the template code with the given variables, solve the birthday probability paradox. import random def do_birthday_simula 1.(N, M, a_seed): random.seed (a_seed) num_hits = 0

using the template code with the given variables, solve the birthday probability paradox.  using the template code with the given variables, solve the birthday
probability paradox. import random def do_birthday_simula 1.(N, M, a_seed): random.seed (a_seed) num_hits

import random def do_birthday_simula 1.(N, M, a_seed): random.seed (a_seed) num_hits = 0 run M simulations and increment num_hits for each one that is a hit " for i in range (M) : This statement generates the N random birthdays birthdays - (random.randint(1,365) for j in range (N) ) Your code goes here" VII if name N = return num_hits / M main 25 M = 100 a_seed - 1972227 print ('For [:d) simulations of groups of (:d) people with seed (:d), the probability of a common birthday is 1:.2)'.format (N,M, a_seed, do birthday_simulation (N, M, a_seed) >> 6.39 Programming Project 1: Probability of Common Birthdays Given a group of people, what is the probability that at least one day of the year is the birthday of two or more members of the group? In this assignment, we will use simulations of groups of people with randomly assigned birthdays to find out The program template given below, my_birthday.py, defines the function do_birthday_simulation() which has three arguments. Nis the number of people, Mis the number of simulation trials to perform and a seed is the seed for the pseudorandom number generator Note that the statement birthdays - [random.randint(1,365) for j in range (N) 1 assigns a random integer between 1 and 365 inclusive to each of elements of a list called birthdays Complete the function definition so that it returns True if at least one of those integers appears two or more times in the list The _main_block is provided in the template so that you can run your program locally on your own computer for testing. It does not matter what the __main_block contains when you submit you will only be graded on the performance of your do_birthday_simulation () function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!