Dice Thrower

Dice image

Introduction

Step 3 – change the die

Not every die has six sides.

I regularly use dice that have 4, 8, 10, 12 and 20 sides. Those are all pretty common in certain types of game.

And there are other types of die as well.

  1. I suggest this time that you start a new Python program
  2. Use the code in the screenshot
  3. Save your program
  4. Run the program to check that it works
  5. Make sure you run your program a few times. You should get a random pattern of die throws
  6. Now change the number of sides on your die. Try 4, 8, 10 and 12 sides. They should all work just fine

Can you figure out which bit of code determines how many sides are on the die?

Code helper image

Make sure to try this with different numbers of sides.