Sort by

recency

|

67 Discussions

|

  • + 0 comments

    can anyone tell me where we need to write the code i am only getting an option to tick the correct answer from MCQ.

  • + 0 comments

    There are 6 possibilities on each die. On 2 dice, there are 6 * 6 = 36 possibilities

    There are 4 cases that match the desired criteria: (1,5) (5,1) (2,4) (4,2)

    This gives us a probability of 4/36 = 1/9

  • + 0 comments

    a = [{a, b} for a in range(1, 7) for b in range(1, 7) if sum({a, b}) == 6] b = [{a, b} for a in range(1, 7) for b in range(1, 7)] print(len(a)/len(b) * 30/36)

    lol

  • + 0 comments
    dice_1 = [1, 2, 3, 4, 5, 6]
    dice_2 = dice_1.copy()
    
    diff_and_sum_to_6 = 0
    all_outcomes = 0
    for v1 in dice_1:
        for v2 in dice_2:
            all_outcomes += 1
            if (v1 != v2) and (v1 + v2 == 6):
                diff_and_sum_to_6 += 1
    
    prob_diff_and_sum_to_6 = diff_and_sum_to_6 / all_outcomes
    print(prob_diff_and_sum_to_6)
    
  • + 0 comments

    dice1 = [1,2,3,4,5,6] dice2 = [1,2,3,4,5,6] total = len(dice1) * len(dice2) total_possibilities = 0

    for i in range(len(dice1)): for j in range(len(dice2)): if (dice1[j] + dice1[i]) <= 9: total_possibilities = total_possibilities + 1 print("{0} + {1} = {2}".format(dice1[i], dice2[j], (dice1[j] + dice1[i])))

    probability = total_possibilities / total print("Probability: {0}/{1} = {2}".format(total_possibilities,total,probability))