Question: using python, For this problem, we're going to test the Birthday Paradox, an interesting mathematical puzzle. You can read the whole explanation at the link
using python, For this problem, we're going to test the Birthday Paradox, an interesting mathematical puzzle. You can read the whole explanation at the link below, but the short version is that mathematically, once you have people in a room, there is a betterthaneven chance that two of them will share a birthday born on the same date To hedge our bets, let's test this out with people which should give us about a chance of a match by creating random "rooms" to see how many of them have a matching date. To make our lives easier, we'll approach this by creating random collections of integers between and representing the days of a standard year and then seeing how many of those collections have a matching pair of numbers. Explanation of the Birthday Paradox: enwikipedia.orgwikiBirthdayproblem Requirements Write a program to do the following: dont use def funtions Declare a constant called TESTS to represent the number of iterations. Set this constant to Declare a constant called SIZE to represent the number of people in the room. Set this constant to Using a loop, generate TESTS number of collections list tuple, etc.: Each collection must have SIZE number of random integers between and So if TESTS is and SIZE is we should create collection objects of random integers each. For the set of collections, count how many have at least one pair of matching numbers. For instance, if I had a smaller collection consisting of and both of those would count as matching collections. When finished, print out a report on the results that includes the actual number of matches and the percentage that matched. See the sample output below for one way to print this. Additional Requirements Somewhere in your code, you must use a list comprehension. You are welcome to determine where and how, but there must be at least one list comprehension in your code. Your final report must use either an fstring or a format with output formatting to print out the results. Requirement Notes The random library might be particularly useful here, especially the random.randint method. When printing your results, you may or may not have a percentage higher than and your numbers may or may not match the sample output's numberpercentage of matches. That's normal! We're dealing with randomness and probability, so these numbers will vary somewhat. However if you're consistently getting percentages that are more than higher or lower than you might want to check your code. You do not need to match the exact verbiage of the sample output below. The important parts are printing out the number and the percentage.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
