<jupyter_start><jupyter_text>Day_7. Pearson Correlation Coefficient I`Task`Given two `n`-element data sets, `X` and , `Y` calculate the value of the Pearson correlation coefficient.`Input Format`The first line contains an integer, `n`, denoting the size of data sets `X` and `Y`. The second line contains `n` space-separated real numbers (scaled to at most one decimal place), defining data set `X`. The third line contains `n` space-separated real numbers (scaled to at most one decimal place), defining data set `Y`.`Constraints`````10 <= n <= 100``1 <= Xi <= 500`, where `Xi` is the `i th` value of data set `X`.`1 <= Yi <= 500`, where `Yi` is the `i th` value of data set `Y`.Data set `X` contains unique values.Data set `Y` contains unique values.````Output Format`Print the value of the Pearson correlation coefficient, rounded to a scale of `3` decimal places.`Sample Input````1010 9.8 8 7.8 7.7 7 6 5 4 2 200 44 32 24 22 17 15 12 8 4````Sample Output````0.612```<jupyter_code>from math import *

n = int(input())
X = tuple(map(float, input().split()))
Y = tuple(map(float, input().split()))

X_bar = sum(X)/len(X)
Y_bar = sum(Y)/len(Y)

X_std = sqrt(sum(list(map(lambda x: x**2, X)))/len(X) - X_bar**2)
Y_std = sqrt(sum(list(map(lambda y: y**2, Y)))/len(Y) - Y_bar**2)

XY_cov = sum([x*y for x, y in zip(X, Y)])/len(X) - X_bar * Y_bar

ro = XY_cov / (X_std * Y_std)
print(f'{ro:.3f}')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1631504922644163, 'fraction_numerical': 0.04149085794655415, 'mean_word_length': 4.761133603238866, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '612300', 'license': 'MIT', 'n_tokens_mistral': 559, 'n_tokens_neox': 496, 'n_words': 190, 'path': '10 Days of Statistics/Day_7. Pearson Correlation Coefficient I.ipynb', 'repo_name': 'Nam-SH/HackerRank', 'size': '1422'}