There is a NumPy function dedicated to finding the standard deviation of a dataset — we can cut out the step of first finding the variance. The NumPy function std() takes a dataset as a parameter and returns the standard deviation of that dataset:

import numpy as np dataset = [4, 8, 15, 16, 23, 42] standard_deviation = np.std()



We’ve removed the code that calculated the variance of each dataset. By using np.std() we don’t need to take that middle step anymore.

Call np.std() using nba_data as a parameter, and store the result in nba_standard_deviation.

Make a similar function call using okcupid_data and store the result in okcupid_standard_deviation.

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?