• + 0 comments
    from fractions import Fraction
    urns = [[4,3],[5,4],[4,4]]
    red = []
    black = []
    for lst in urns:
        red.append(Fraction(lst[0],sum(lst)))
        black.append(Fraction(lst[1],sum(lst)))
    doub = []
    for i in range(len(red)-1):
        for j in range(i+1, len(red)):
            doub.append(red[i]*red[j])
    final = []
    for j in range(len(black)):
        final.append(doub[j]*black[len(black)-j-1])
    print(sum(final))