def calculate_correlation(x, y):
mean_x = sum(x) / len(x)
mean_y = sum(y) / len(y)
numerator = sum((xi - mean_x) * (yi - mean_y) for xi, yi in zip(x, y))
denominator = (sum((xi - mean_x) ** 2 for xi in x) * sum((yi - mean_y) ** 2 for yi in y)) ** 0.5
return numerator / denominator if denominator else 0