anoldmaninthesea
I'm trying to solve the following challenge
https://www.hackerrank.com/challenges/s10-weighted-mean/problem?h_r=next-challenge&h_v=zen
On my Jupyter notebook the following function solves it:
```
def weightedMean(X, W):
# Write your code here
dotprd=sum([x*w for (x,w) in zip(X,W)])
return dotprd/sum(W)
```
However, on the site of the challenge, my function returns nothing...
> ~ no response on stdout ~
why is that?

Top Answer

Tejas Shetty
You need to call your function after defining it.
```
def weightedMean(X, W):
# Write your code here
dotprd=sum([x*w for (x,w) in zip(X,W)])
return dotprd/sum(W)
X1 = [1, 3 ,5, 78, 39]
W1 = [0.1, 0.34, 0.49, 0.06, 0.01]
weightedMean(X1, W1)
```
will result in
8.64