Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function dice () that takes an integer count as a parameter, simulates rolling a dice for count times, i.e. generating a random integer

Write a function dice() that takes an integer count as a parameter, simulates rolling a dice for count times, i.e. generating a random integer between 1 and 6 for count times, collects the information on the number of times when the dice stops at each possible value, i.e. from 1 to 6, and prints the collected information after the simulation. Your should use dictionary to implement the function and the function should NOT use any if statement. The following screenshot shows a couple of example runs:

image text in transcribed

- O X Help Le Python 3.7.4 Shell File Edit Shell Debug Options Window >>> dice (10) 1 : 1 2 : 2 3 : 4 4 : 1 5 : 1 6 : 1 >>> dice (100) 1 : 14 2 : 16 3 : 16 4 : 18 5 : 19 6 : >>> Ln: 219 Col: 4

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

Step: 3

blur-text-image

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

25 Vba Macros For Data Analysis In Microsoft Excel

Authors: Klemens Nguyen

1st Edition

B0CNSXYMTC, 979-8868455629

More Books

Students also viewed these Databases questions

Question

1. Give an example of hierarchical planning in an organization.

Answered: 1 week ago