As we saw in the last exercise, knowing the standard deviation of a dataset can help us understand how spread out our dataset is.

We can find the standard deviation of a dataset using the Numpy function np.std:

>>> nums = np.array([65, 36, 52, 91, 63, 79]) >>> np.std(nums) 17.716909687891082



You’ve been asked to judge your town’s annual squash festival. The festival organizer gives you a list that includes all the weights for the two competitions that you’re judging: pumpkins and acorn squash.

Given the two data sets at the top of script.py, find the average weight for each competition and save them to the variables pumpkin_avg and acorn_squash_avg.


Now, the rest of the judges want you to give them an idea of how representative the mean values are in relation to the entirety of the submissions. Calculate the standard deviation for each of the datasets to find and save them to the variables pumpkin_std and acorn_squash_std. Print them to the console to see their values.


Determine the squash dataset that has the greater standard deviation and save it to the variable winner.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?