Question: python coding Birthday Problem The birthday problem concerns the probability that in a group of people, two people will have the same birthday. Of course,

python coding Birthday Problem

The "birthday problem" concerns the probability that in a group of people, two people will have the same birthday. Of course, as the size of the group increases, the probability of two people sharing the same birthday increases as well. Surprisingly, in a group of just 23 people, there is a 50% probability that at least two people will have the same birthday!

The probability of two people in a group of n people having the same birthday may be calculated as follows:

python coding Birthday Problem The "birthday problem" concerns the probability that in

Requirements:

Write a program named Birthdays.py that prompts the user for the minimum and maximum number of people and then outputs the probability that two people will have the same birthday for every number between the minimum and maximum. The probability values should be calculated using the above formula, and displayed with four decimal places and rounded to the nearest decimal place, as shown below.

For example (the red ink highlights the user input, the blue ink highlights the expected output),

a group of people, two people will have the same birthday. Of

Design:

Your program must prompt the user for the input values and use the method given below to calculate each probability. Your program will output each probability with 4 decimal places and rounded to the nearest decimal place. The output must be displayed in columns as shown above.

Your should define a calculate_probability function and documented as shown below:

course, as the size of the group increases, the probability of two

Implementation:

people sharing the same birthday increases as well. Surprisingly, in a group

p(n) = 1-365/365 #364/365 * 363/365 * ..* (365-n + 1)/365 For example, in a group of 4 people, the probability of two people having the same birthday would be calculated as follows: p(4) -1 -365/365 * 364/365 * 363/365 * (365 -4 +1)/365 1-365/365 * 364/365 * 363/365 * 362/365 016355912466550215

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!