Skip to content

Instantly share code, notes, and snippets.

@kurasaiteja
Last active August 12, 2020 14:57
Show Gist options
  • Select an option

  • Save kurasaiteja/0ce28660d7320a33fcfeb6e86118a177 to your computer and use it in GitHub Desktop.

Select an option

Save kurasaiteja/0ce28660d7320a33fcfeb6e86118a177 to your computer and use it in GitHub Desktop.
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