172k views
1 vote
Define a function roll_hundred_pair() that produces a histogram of the results of 100 rolls of two 6-sided dice

1 Answer

5 votes

Answer:

The code is attached. I used python to define the function and matplotlib library to plot the histogram.

Explanation:

  1. I defined a function called roll_hundred_pair
  2. I imported matplotlib.pyplot as plt and random
  3. I defined a list called dice
  4. I created an empty list to collect dice results
  5. I simulated 100 dice roll using a loop and random.sample
  6. finally I plot the histogram using plt.hist method
Define a function roll_hundred_pair() that produces a histogram of the results of-example-1
User Nosbor
by
8.7k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories