We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 2: Basic Probability
Day 2: Basic Probability
Sort by
recency
|
83 Discussions
|
Please Login in order to post a comment
Failled 3 times without knowing i wouldnt have another try ..ever . Maybe it would be better to warn users about it .. OR after 3 errors , reset the challenge with another question and other parameters .. Or even better just forget about the multiple choice.. And let us code .
The given answer choices don't match the real answer; should be 1/9
from itertools import product from fractions import Fraction
P = list(product([1, 2, 3, 4, 5, 6], repeat=2))
N = sum(1 for x in P if sum(x) <= 9)
print(Fraction(N, len(P)))