Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago