Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey I need help with this python question I have add the code I already have it must use import random and random.seed(30) In this

Hey I need help with this python question I have add the code I already have it must use import random and random.seed(30)

image text in transcribed

In this exercise you will simulate 100 rolls of n dice. Write a function named create_dice_dictionary(n) which takes an integer n as a parameter and returns a dictionary. The function should simulate rolling n six-sided dice for 100 times. As the function runs, it should count the number of times that each total of the dice occurs. Create a dictionary of keys from n to n * 6 inclusive. Each key has a corresponding value which is the number of times each total occurs. You can assume that the integer parameter is positive (i.e. greater than 0). Note: you should use the following code in order to generate the same set of random numbers: import random random.seed (30) For example: Result t(create_dice_dictionary(2)) {2: 2, 3: 6, 4:6, 5: 11, 6: 16, 7: 15, 8: 16, 9: 15, 10: 7, 11: 5, 12: 1} Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1 import random 2 random.seed(30) 3def create_dice_dictionary(n): 4 rolls = {} 5 for i in range(n, n * 6 + 1): 6 rolls[i] 0 7

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

Students also viewed these Databases questions