• + 1 comment

    Enter your code here. Read input from STDIN. Print output to STDOUT

    import numpy as np

    def covariance(x,y): pmax=-1e9 pmax_index=-1 for i in range(5): if (np.cov(x[i],y)[1][0]>pmax): pmax=np.cov(x[i],y)[1][0] pmax_index=i+1 return pmax_index

    t = int(input()) for i in range(t): n = input() cgpa = [float(a) for a in input().split()] coeflist = [] marks_1 = [float(x) for x in input().split()] marks_2 = [float(x) for x in input().split()] marks_3 = [float(x) for x in input().split()] marks_4 = [float(x) for x in input().split()] marks_5 = [float(x) for x in input().split()] marks=np.array([marks_1,marks_2,marks_3,marks_4,marks_5]) print(covariance(marks,np.array(cgpa)))