Skip to content

Instantly share code, notes, and snippets.

@jtemporal
Last active July 19, 2018 12:27
Show Gist options
  • Save jtemporal/8a28c192f7ccb739bd3455d37cc3995e to your computer and use it in GitHub Desktop.
Save jtemporal/8a28c192f7ccb739bd3455d37cc3995e to your computer and use it in GitHub Desktop.
Lesson 13: Variability - Quiz 32: SD social networkers
import math
# data (dados)
x = [38946, 43420, 49191, 50430, 50557, 52580, 53595, 54135, 60181, 62076]
# mean (média)
mean = sum(x)/len(x)
# Deviation from the mean (desvio da média)
desv = [number - mean for number in x]
# Average deviation from the mean (desvio médio)
avg_desv = sum(desv)/len(x)
# Sum of squares (soma dos quadrados)
ss = sum([math.pow((number - mean), 2) for number in x])
# Variance (variância)
var = ss/len(x)
# Standard deviation (desvio padrão)
sigma = math.sqrt(var)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment