You are viewing a single comment's thread. Return to all comments →
import math from fractions import Fraction def reducto(num, den): pgcd = math.gcd(num, den) s_num = num // pgcd s_den = den // pgcd return s_num, s_den def prob_direct(nbr_possibilities, favorable_events): max_events = nbr_possibilities * nbr_possibilities return Fraction(*reducto(favorable_events, max_events)) def prob_comp(frac): return 1 - frac def Bayne(a,b): return a/b A = prob_direct(2, 1) B = prob_comp(A) C = Bayne(A,B) print("Bayne:",C)
Seems like cookies are disabled on this browser, please enable them to open this website
Day 3: Conditional Probability
You are viewing a single comment's thread. Return to all comments →