You are viewing a single comment's thread. Return to all comments →
alternative non numpy solution
n=int(input()) x=list(map(float,input().split())) w=list(map(float,input().split()))
m=0 for i in range(n): m=+x[i]*w[i]
print(round(m/sum(w),1))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 0: Weighted Mean
You are viewing a single comment's thread. Return to all comments →
alternative non numpy solution
n=int(input()) x=list(map(float,input().split())) w=list(map(float,input().split()))
m=0 for i in range(n): m=+x[i]*w[i]
print(round(m/sum(w),1))