Alexa was coming up to her final exams, which were set across 18 days. Each of the 18 days had 2 sessions, a morning and an afternoon session. Alexa had to complete 6 exams altogether.
When the exam timetable was released, Alexa was very disappointed that she had 2 days on which she had to complete 2 exams, one in the morning and one in the afternoon, on that same day.
Determine the probability that Alexa would find her 6 exams set on just 4 days.
Method 1: Output of program
[0, 0, 0, 816, 73440, 685440, 1188096]
sum is 1947792 = combin(36,6)
73440 corresponds to testing being done in 4 days.
73440/1947792 = 90/2387
=0.037704231252618356
Method 2: analytic
153 combin(18,2) ways to choose the 2 days of double testing
120 combin(16,2) ways to choose the 2 days of partial testing
4 ways of having the 2 partial test days distributed between AM and PM
720 6! ways of shuffling the 6 exams among the above time slots
52876800 = 153 * 120 * 4 * 720 total ways of tests being exactly 4 days
1402410240 = 36! / 30! total ways for tests to be distributed into time slots
52876800 / 1402410240 = 0.0377042312526183
-------------------
from itertools import combinations
days = [0 for i in range(7)]
for comb in combinations([i for i in range(36)],6):
x = sorted(comb)
count = 6
for n in x:
if n%2 == 0 and n+1 in x:
count -= 1
days[count] += 1
print(days)
|
Posted by Larry
on 2023-12-15 14:39:42 |