Write a function named Dire() to generate random integers.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Write a function named Dice() to generate random integers.
The function will receive a no arguments and have no return value. All data will be entered using
the input() function, and all output using the disp() function.
When run, the function will present the user with a menu to choose different sided dice including
4,6,8,10,12 and 20. If the user does not choose one of the valid types they will be asked to try again.
The process will be repeated until 3 dices are selected.
After three dices are selected the program will roll the dice and display the result for each dice and
the sum of the three dices
Finally the user will be asked if they wish to go again, either by typing letters (i.e. Y/N) or numbers
(i.e. 1/0).
This function must make use of at least one while() loop, but may also make use of other loops or
conditional statements as required.
Sample output:
--> Dice()
You must select 3 dices from the selection below please select your first dice?
From 4,6,8,10,12, 20: 6
Thank you for selecting a six sided dice please select another dice from
4,6,8,10,12, 20:4
Thank you for selecting a four sided dice please select another dice from
4, 6, 8, 10, 12, 20: 8
Thank you for selecting a eight sided dice. I will roll the dice now
Dice 1: 5
Dice 2: 4
Dice 3: 2
The sum of your dice rolls is 11
Go again? [Y/N]: y
You must select 3 dices from the selection below please select your first dice?
From 4, 6, 8, 10, 12, 20: 6
Note include both your full function code, and code demonstrating use of your function below.
Transcribed Image Text:Write a function named Dice() to generate random integers. The function will receive a no arguments and have no return value. All data will be entered using the input() function, and all output using the disp() function. When run, the function will present the user with a menu to choose different sided dice including 4,6,8,10,12 and 20. If the user does not choose one of the valid types they will be asked to try again. The process will be repeated until 3 dices are selected. After three dices are selected the program will roll the dice and display the result for each dice and the sum of the three dices Finally the user will be asked if they wish to go again, either by typing letters (i.e. Y/N) or numbers (i.e. 1/0). This function must make use of at least one while() loop, but may also make use of other loops or conditional statements as required. Sample output: --> Dice() You must select 3 dices from the selection below please select your first dice? From 4,6,8,10,12, 20: 6 Thank you for selecting a six sided dice please select another dice from 4,6,8,10,12, 20:4 Thank you for selecting a four sided dice please select another dice from 4, 6, 8, 10, 12, 20: 8 Thank you for selecting a eight sided dice. I will roll the dice now Dice 1: 5 Dice 2: 4 Dice 3: 2 The sum of your dice rolls is 11 Go again? [Y/N]: y You must select 3 dices from the selection below please select your first dice? From 4, 6, 8, 10, 12, 20: 6 Note include both your full function code, and code demonstrating use of your function below.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education