Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How would I find the minimum number of classmates such that the probability of two or more people have a same birthday is at least

How would I find the minimum number of classmates such that the probability of two or more people have a same birthday is at least 50%. import random Birth = 25 numTrials = 1000 Dup = 0 for trial in range(numTrials): year = [0]*365 for i in range(Birth): newBDay = random.randrange(365) year[newBDay] = year[newBDay] + 1 DupMatch = False for num in year: if num > 1: DupMatch = True if DupMatch == True: Dup = Dup + 1 prob = Dup / numTrials print("The probability of a shared birthday in a class of ", Birth, " is ", prob)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions