def calculate_variance(data): mean = sum(data) / len(data) return sum((x - mean) ** 2 for x in data) / len(data)