Last active
August 12, 2020 14:57
-
-
Save kurasaiteja/0ce28660d7320a33fcfeb6e86118a177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def standard_deviation(array): | |
| mean = sum(array) / len(array) | |
| distances = [] | |
| for value in array: | |
| # appending square of distances | |
| distances.append(((value - mean)**2)) | |
| return sum(distances) / len(distances) | |
| input = [1,1,1,1,1,1,1,1,1,21] | |
| std = np.sqrt(variance(input)) | |
| # Output - 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment