๐Ÿ PyQuest๐Ÿ•น๏ธ Challenge Arcade ยท ๐ŸŽฒ Dice Doubles
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Dice Doubles ๐ŸŽฒ

Roll two dice. If they match, that's doubles. How often does that happen? Let's find out the scientific way: roll them 100 times. ๐Ÿ”ฌ

import random

die = random.randint(1, 6)     # a random whole number from 1 to 6

randint includes both ends, so you really can get a 1 or a 6.

To do something 100 times you don't need the loop variable at all โ€” range(100) just spins round 100 times:

for roll in range(100):
    print("rolling!")

Your mission

  1. Roll two dice, 100 times
  2. Count how many rolls came out as doubles โ€” store it in a variable called doubles
  3. Print the result

Run it a few times. The number changes! What do you think it should be, out of 100? ๐Ÿค“

Your code

Press โ–ถ Run to see what your code does!