Back to Practice
#0087

Probability With Two Dice

EasyAptitude12 min10 XP

Problem

Two fair dice are rolled. What is the probability that the sum is 9?

Why This Matters

Probability questions become easier when you list the sample space clearly instead of guessing formulas.

Examples

Example 1
Inputtwo dice, sum 9
Output1/9

There are four ordered outcomes.

Constraints

  • Dice outcomes are ordered pairs.
  • Use total outcomes 36.
  • Simplify the fraction.
CodeReasoning
Two fair dice are rolled. What is the probability that the sum is 9?
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Sum equals 9
Inputtwo dice
Expected1/9

Four favorable ordered pairs out of 36.

Hidden Test Categories
sum 7doublesat least one six