Answered step by step
Verified Expert Solution
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:
- 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: 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started