Unit 2 Task 33 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 33: Dice doubles at the café

← Back to task


One possible program:

import random

rolls = 0

while True:
    first_die = random.randint(1, 6)
    second_die = random.randint(1, 6)
    rolls += 1
    print(first_die, second_die)
    if first_die == second_die:
        break

print("Rolls until doubles:", rolls)