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 23 people in a room, there is a better-than-even chance that two of them will share a birthday (born on the same date). To hedge our bets, let's test this out with 30 people (which should give us about a 70% chance of a match) by creating 50 random "rooms" to see how many of them have a matching date. To make our lives easier, we'll approach this by creating 50 random collections of 30 integers between 1 and 365(representing the 365 days of a standard year) and then seeing how many of those 50 collections have a matching pair of numbers. Explanation of the Birthday Paradox: en.wikipedia.org/wiki/Birthday_problem Requirements Write a program to do the following: dont use def funtions 1. Declare a constant called TESTS to represent the number of iterations. Set this constant to 50.2. Declare a constant called SIZE to represent the number of people in the room. Set this constant to 30.3. Using a loop, generate TESTS number of collections (list, tuple, etc.): Each collection must have SIZE number of random integers between 1 and 365. So if TESTS is 50 and SIZE is 30, we should create 50 collection objects of 30 random integers each. 4. 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 [1,4,2,8,2,12] and [1,3,4,29,10,4,3,7] both of those would count as matching collections. 5. 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 f-string 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 70%, and your numbers may or may not match the sample output's number/percentage 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 10% higher or lower than 70%, 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 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 Programming Questions!