You are viewing a single comment's thread. Return to all comments →
#python from statistics import pstdev, mean n=int(input()) X=list(map(float, input().split())) Y=list(map(float, input().split())) res=[(X[i]-mean(X))*(Y[i]-mean(Y)) for i in range(n)] p=sum(res)/(n*pstdev(X)*pstdev(Y)) print(round(p, 3))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 7: Pearson Correlation Coefficient I
You are viewing a single comment's thread. Return to all comments →