Question

in python The birthday paradox says that the probability that two people in a room will...

in python The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided n, the number of people in the room, is more than 23. This property is not really a paradox, but many people find it surprising. Design a Python program that can test this paradox by a series of experiments on randomly generated birthdays, which test this paradox for n = 5, 6, 7, ..., 50. To achieve a reasonably accurate probability, I suggest you repeat at least 1000 times for each n value

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Note: Brother sometimes while uploading on HomeworkLib the indentations change. So, I request you to verify it with screenshot once. This is the link where I have saved the code too

https://onlinegdb.com/Byp8b1dLS

import random
people=5;
birth_day=list(range(1,366));
while(people<=50):
newbirth_Day=[];
count=0;
iteration=100000;
while(iteration!=0):
count=0;
for i in range(people):
day=random.randint(0,364);
newbirth_Day.append(day);
for i in range(people):
bday=newbirth_Day[i];
for j in range(i+1,people):
if(bday==newbirth_Day[j]):
count=count+1;
break;
iteration=iteration-1;
print("For people",people,"\nProbability:",count,"/",1000);
people=people+1;

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
in python The birthday paradox says that the probability that two people in a room will...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The birthday problem is as follows: given a group of n people in a room, what...

    The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have the same birthday? It is possible to determine the answer to this question via simulation. Using the starting template provided to you, complete the function called calc birthday probability that takes as input n and returns the probability that two or more of the n people will have the same birthday. To do this,...

  • What is the probability that in a room of n people, at least three of them...

    What is the probability that in a room of n people, at least three of them have the same birthday? Explain all the terms in your solution. What is the fewest amount of people such that the probability of at least three of these people having the same birthday is greater than 1/3? You will have to code your solution from the first question and plug in values for n. Include the code snipped you used to solve this.

  • Random variables and expected value Shared Birthday Height Arrangements Example: How many pairs of people in...

    Random variables and expected value Shared Birthday Height Arrangements Example: How many pairs of people in this room do we expect to share a birthday? Example: If we randomly arrange n people in a line, what is the expected number of people who are taller than all adjacent people? Assume each person's height is different (no ties). If there are 30 people in the room, how many pairs of people are there? What is the probability that two particular people...

  • 1/ Consider the following table. Defects in batch Probability 2 0.18 3 0.29 4 0.18 5...

    1/ Consider the following table. Defects in batch Probability 2 0.18 3 0.29 4 0.18 5 0.14 6 0.11 7 0.10 Find the standard deviation of this variable. 1.52 4.01 1.58 2.49 2/ The standard deviation of samples from supplier A is 0.0841, while the standard deviation of samples from supplier B is 0.0926. Which supplier would you be likely to choose based on these data and why? Supplier B, as their standard deviation is higher and, thus, easier to...

  • Problem 2. Consider the following joint probabilities for the two variables X and Y. 1 2...

    Problem 2. Consider the following joint probabilities for the two variables X and Y. 1 2 3 .14 .25 .01 2 33 .10 .07 3 .03 .05 .02 Find the marginal probability distribution of Y and graph it. Show your calculations. b. Find the conditional probability distribution of Y (given that X = 2) and graph it. Show your calculations. c. Do your results in (a) and (b) satisfy the probability distribution requirements? Explain clearly. d. Find the correlation coefficient...

  • Name: Section Number To be graded assignments must be completed and submitted on the original book...

    Name: Section Number To be graded assignments must be completed and submitted on the original book page Hypothesis Testing -As a Diagnostic Test ? Answer the following questions over the content material you just read or watched. 1. What is a false positive rate in the context of hypothesis testing? 2. What is the goal of hypothesis testing? 3. What is a Type I error, and how is it related to an "alpha level?" 4. What does it mean to...

  • 1. Many companies use a incoming shipments of parts, raw materials, and so on. In the...

    1. Many companies use a incoming shipments of parts, raw materials, and so on. In the electronics industry, component parts are commonly shipped from suppliers in large lots. Inspection of a sample of n components can be viewed as the n trials of a binomial experimem. The outcome for each component tested (trialD will be that the component is classified as good or defective defective components in the lot do not exceed 1 %. Suppose a random sample of fiver...

  • Case Study 1: Drive-Thru Service Times @ McDonald's (McDonalds Drive-Thru Waiting Times spreadsheet) When you're on...

    Case Study 1: Drive-Thru Service Times @ McDonald's (McDonalds Drive-Thru Waiting Times spreadsheet) When you're on the go and looking for a quick meal, where do you go? If you're like millions of people every day, you make a stop at McDonald's. Known as "quick service restaurants" in the industry (not "fast food"), companies such as McDonald's invest heavily to determine the most efficient and effective ways to provide fast, high-quality service in all phases of their business. Drive-thru operations...

  • The following ANOVA model is for a multiple regression model with two independent variables: Degrees of            Sum of                 Mean Source           Freedom            Squares              ...

    The following ANOVA model is for a multiple regression model with two independent variables: Degrees of            Sum of                 Mean Source           Freedom            Squares                Squares       F       Regression            2                    60 Error                   18                 120 Total                   20                 180 Determine the Regression Mean Square (MSR): Determine the Mean Square Error (MSE): Compute the overall Fstat test statistic. Is the Fstat significant at the 0.05 level? A linear regression was run on auto sales relative to consumer income. The Regression Sum of Squares (SSR) was 360 and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT