You are viewing a single comment's thread. Return to all comments →
Python 3 code
from fractions import Fraction bag1 = ['r']*4 + ['b']*5 bag2 = ['r']*3 + ['b']*7 combo = [] visited = 0 for i in bag1: for e, j in enumerate(bag2): for k in bag2[e+1:]: temp = [i, j, k] if (temp.count('r') == 1) and (temp.count('b') == 2): combo.append(temp) visited += 1 print(Fraction(len(combo), visited))
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 →
Python 3 code