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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!