Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write program that uses a function named throwDie that simulates throwing a die. When you call the function, it should generate a random number in

Write program that uses a function named throwDie that simulates throwing a die. When you call the function, it should generate a random number in the range of 1 through 6. Demonstrate the function in a program that asks the user how many times the die should be thrown, then simulates the throwing of the die that number of times. At the end of the program display the number of times each value appears. Note: Your solution MUST have and call a function to do the die throw in order to get full credit for this assignment!

The output should look something like this: How many die throws should I make? 8

1:      1

2:      5

3:      3

4:      6

5:      3

6:      4

7:      5

8:      1

 

 

1 appears 2
2 appears 0
3 appears 2
4 appears 1
5 appears 2
6 appears 1

Step by Step Solution

3.40 Rating (147 Votes )

There are 3 Steps involved in it

Step: 1

Heres a Python program that uses a function called throwDie to simulate throwing a die python import ... 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

Starting Out With Java From Control Structures Through Data Structures

Authors: Tony Gaddis

6th Edition

0133957055, 978-0133957051

More Books

Students also viewed these Databases questions

Question

Solve the given equations. 0.1x 0.5(x 2) = 2

Answered: 1 week ago