Sort by

recency

|

84 Discussions

|

  • + 0 comments

    I kept getting it wrong because I kept forgetting to add the 9s. I was adding only the numbers less than 9

  • + 0 comments

    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 .

  • + 1 comment

    The given answer choices don't match the real answer; should be 1/9

  • + 0 comments
    # Dice # 1
    dice_1 = [1, 2, 3, 4, 5, 6]
    
    # Dice # 2
    dice_2 = dice_1.copy()
    
    less_than_10 = 0
    all_outcomes = 0
    
    # Iterate through
    for v1 in dice_1:
        for v2 in dice_2:
    # add 1 for every pair to all_outcomes
            all_outcomes += 1
            if v1 + v2 < 10:
    # add 1 for pairs that summed up to 9 or below to less_than_10.
                less_than_10 += 1
    
    prob_less_than_10 = less_than_10 / all_outcomes
    print(prob_less_than_10)
    
  • + 0 comments

    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)))