Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function simulate_dice_rolls which takes in two params, num_rolls and iterations. It should return a 1-D Numpy array of length iterations, where each item

Write a function simulate_dice_rolls which takes in two params, num_rolls and iterations. It should return a 1-D Numpy array of length iterations, where each item is the sum of throwing a fair 6-sided die num_rolls times. It should also automatically output a histogram of the rolls to the file dice_{0}_rolls_{1}.png, where {0} is num_rolls and {1} is iterations. (No need for any labels, title, legends, etc.)

Run your function for num_rolls = 5 and iterations = 2000 and paste the plot here.

For this assignment, you should not use loops! You should be using vectorized operations. Functional iterators are also not allowed.

The following operations will be deducted: for, while, comprehensions (like [x for x in range(10)], map(), and filter().

Use python 3.8. Thanks!

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

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions