Question
Write the python code to write a function that simulates the throwing of any even numbered dice which will be passed on as a parameter:
Write the python code to write a function that simulates the throwing of any even numbered dice which will be passed on as a parameter: customDice(sides). The function will return a random number rolled for that particular type of dice. Write the program that will utilize the customDice function with the following specification: Ask the user to pick which even-sided dice to use. The program will then roll the dice twice. If the total of both rolls is greater than the number of die sides+1, then they lose. If not, they win. Write statements that prompt the user for the type of dice to use, print the value from the two rolls and a message whether they win or lose. If the user enters an odd number, ask for the input again.
Sample dialogs:
Please choose an even-sided dice: 3
Sorry, it must be an even-sided dice.
Please choose an even-sided dice: 10
Roll 1: 3
Roll 2: 10
Total: 13
You lose (13 > 11)!
Please choose an even-sided dice: 8
Roll 1: 3
Roll 2: 2
Total: 5
You win (5 < 9)!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started