top of page

PROGRAMMING CHALLENGES

Dice Roller

Difficulty:

1 Easy

1.1 Random Numbers

Topic:

Write a program that simulates rolling a dice. The program should ask the user to input the number of sides the dice has (e.g., 6 for a standard dice, 20 for a D20 in RPGs), and then generate a random number within that range.

INPUTS: 

Number of sides for the dice (integer)


PROCESSES:

1. Import the random module

2. Accept user input for the number of sides

3. Generate a random number between 1 and the specified number of sides using random.randint()


OUTPUTS: 

Random number representing the dice roll (integer)








Need help with your programming skills?

If you need more help than just independent practise, then we're here for you. Book a 1:1 with us and we will be able to guide you to becoming a proficient programmer who can tackle any of the challenges an exam board can throw at you.

bottom of page