Session Ready
Exercise

Plotting the sample mean

Now let's plot the sample mean, so you can see more clearly how it evolves as more data becomes available.

For this exercise we'll again use the sample you generated earlier, which is available in the sample variable. The binom object and describe() function have already been imported for you from scipy.stats, and matplotlib.pyplot is available as plt.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3

In a for statement for i in a range that goes from 2 to 251, do the following:

  • Calculate the sample mean for the first i values.
  • Use append to add the value to the averages array.