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...

  • Solve for part b and e People who eat lots of fruits and vegetables have lower...

    Solve for part b and e People who eat lots of fruits and vegetables have lower rates of colon cancer than those who eat little of these foods. Fruits and vegetables are rich in "antioxidants" such as vitamins A, C, and E. Will taking antioxidants help prevent colon cancer? A medical experiment studied this question with 864 people who were at risk of colon cancer. The subjects were divided into four groups: daily beta-carotene, daily vitamins C and E, all...

  • 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...

  • Example 8.4 An automobile model is known to sustain no visible damage 25% of the time...

    Example 8.4 An automobile model is known to sustain no visible damage 25% of the time in 10-mph crash tests. A modified bumper design has been proposed in an effort to increase this percentage. Let p denote the proportion of all 10-mph crashes with this new bumper that result in no visible damage. The hypotheses to be tested are Ho: P = 0.25 (no improvement) versus Ha: p ? ? 0.25. The test will be based on an experiment involving...

  • 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...

  • WHEN 19-YEAR-OLD MICHAEL Dell began selling personal computers out of his college dorm room in 1984,...

    WHEN 19-YEAR-OLD MICHAEL Dell began selling personal computers out of his college dorm room in 1984, few would have bet on his chances for success. In those days, most computer makers sold their PCs through an extensive network of all-powerful distributors and resellers. Even as the fledgling Dell Computer Corporation began to grow, competitors and industry insiders scoffed at the concept of mail-order computer marketing. PC buyers, they contended, needed the kind of advice and hand-holding that only full-service channels...

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
ADVERTISEMENT