Question: Please follow the steps that were given. USE PYTHON ONLY. (Birthday Problem) Suppose that people enter an empty room until a pair of people share

Please follow the steps that were given. USE PYTHON ONLY.

(Birthday Problem) Suppose that people enter an empty room until a pair of people share a birthday. On average, how many people will have to enter before there is a match? Write a program birthday.py that takes an integer trial from the command line and runs trials experiments to estimate this quantity, where each experiment involves sampling individuals until a pair of them share a birthday. Assume birthdays to be uniform random integers from the interval [0, 365).

$ python3 birthday. py 1000

24

Please follow the steps that were given. USE PYTHON ONLY. (Birthday Problem)Suppose that people enter an empty room until a pair of people

birthday.py (/coursework/homework4) File Edit View Search Tools Documents Help # birthday.py: estimates the number people that must be sampled until a # pair of them share a birthday. import random import stdarray import stdio import sys DAYS PER YEAR 365 # Get trials from command line, as an int. trials = # Define a variable count denoting the total number of individuals sampled # across the trials number of experiments, and initialize it to cound = # Peform trials number of experiments, where each experiment involves sampling # individuals until a pair of them share a birthday. for t in range(.. .): # Setup a 1D list birthdays seen of DAYS-PER-YEAR booleans, all set to # False by default. This list will keep track of the birthdays encountered # in this experiment. birthdays-seen -... # Sample individuals until match. while...: # Increment count by 1 Python Tab Width: 4 Ln 21, Col 32 INS homework4 - File Manager birthday.py (/coursewor.... |-1) 3:20 pm birthday.py (/coursework/homework4) File Edit View Search Tools Documents Help # birthday.py: estimates the number people that must be sampled until a # pair of them share a birthday. import random import stdarray import stdio import sys DAYS PER YEAR 365 # Get trials from command line, as an int. trials = # Define a variable count denoting the total number of individuals sampled # across the trials number of experiments, and initialize it to cound = # Peform trials number of experiments, where each experiment involves sampling # individuals until a pair of them share a birthday. for t in range(.. .): # Setup a 1D list birthdays seen of DAYS-PER-YEAR booleans, all set to # False by default. This list will keep track of the birthdays encountered # in this experiment. birthdays-seen -... # Sample individuals until match. while...: # Increment count by 1 Python Tab Width: 4 Ln 21, Col 32 INS homework4 - File Manager birthday.py (/coursewor.... |-1) 3:20 pm

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!