Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python only with those specific imports only # birthday.py: estimates the number people that must be sampled until a # pair of them share a

python only with those specific imports only

# 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 0. 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. ... # Define a variable birthday with a random integer from the interval # [0, DAYS_PER_YEAR). birthday = ... # If birthday has been encountered, abort this experiment. if ...: break # Record the fact that we are seeing this birthday for the first time. ... # Write the average number of people that must be sampled before a match, as # an int. ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago