You are viewing a single comment's thread. Return to all comments →
from math import comb
total_ways = comb(9, 1) * comb(10, 2)
ways_case_A = comb(4, 1) * comb(7, 2)
ways_case_B = comb(5, 1) * comb(7, 1) * comb(3, 1)
successful_ways = ways_case_A + ways_case_B
from fractions import Fraction probability = Fraction(successful_ways, total_ways)
print(probability)
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Basic Probability Puzzles #4
You are viewing a single comment's thread. Return to all comments →
from math import comb
total_ways = comb(9, 1) * comb(10, 2)
ways_case_A = comb(4, 1) * comb(7, 2)
ways_case_B = comb(5, 1) * comb(7, 1) * comb(3, 1)
successful_ways = ways_case_A + ways_case_B
from fractions import Fraction probability = Fraction(successful_ways, total_ways)
print(probability)