Skip to content

Instantly share code, notes, and snippets.

@ooade
Created September 5, 2016 12:07
Show Gist options
  • Save ooade/41bd825837a446075124f5d5df54af2c to your computer and use it in GitHub Desktop.
Save ooade/41bd825837a446075124f5d5df54af2c to your computer and use it in GitHub Desktop.
Hackerrank Statistics Day 0: Weighted Mean
raw_input()
m = raw_input()
w = raw_input()
w = [float(i) for i in w.split()]
m = sum([w[int(i)] * int(j) for i, j in enumerate(m.split())])
print "%.1f" % (m / sum(w))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment