Standard Deviation Algorithm

In statistics, given a set list of numbers, the standard deviation is a measure of the amount of variation or dispersion within the set.

A low standard deviation indicates that the values tend to be close to the mean value of the set.
A high standard deviation indicates that the values are spread out over a wider range.

The formula to calculate the standard deviation for a given set of numbers is as follows:

Where x represents the mean value of the set and n represents the number of values in the set.

Your task is to design an algorithm for a function called standardDeviation() that takes one parameter: a list of integer values. The list can be of any length. Your function will calculate and return the standard deviation for this given list.

Python Code

We have started the code for you by creating a function called inputList() that lets the user input any list of numbers, one number at a time. Your task is now to add the code for the standardDeviation() function.

Test Plan

Test # Input Values Expected Output Actual Output
#1 7,14,9,21,32,15 8.3199893162325
#2 23,101,52,48,107 32.480147782915
#3 10,40 15


The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 8

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!