Dice
Q1. Get this code working:
import random
total = 0
for number in range(3):
roll = random.randrange(1,7)
print(roll)
total = total + roll
print('The total of rolling the dice 3 times is',total)
Q2. Describe what the code does.
Q3. Modify the code so that you ask the user how many times they want to roll the dice and then use that number. Make any appropriate changes needed to the printed out messages.
Q4. A game called Dungeons and Dragons uses a 20-sided dice. Modify the code so that it can be used for this game.
Q5. Describe your approach to testing your code.
Q6. Modify your program so that a single 6-sided dice roll is in a function, which you can call each time you need to roll a dice. Test it works.
Q7. Using your function from Q6, throw a dice twice and display the total.
Q8. Modify the function so the dice is thrown three times.
Q9. Annotate your code using the hash symbol #.
Q10. Add a docstring to your function.