In [1]:
examples_of_resources = [
[5, 5, 5],
[5, 10, 5],
[5, 25, 5],
[5, 40, 5],
[0, 250, 0],
[0, 2500, 0],
[0, 25000000, 0],
[0, 25000000, 0, 0],
[0, 25000000, 0, 0, 0, 0, 0, 0, 0, 0],
]
In [2]:
def get_jain(resources):
denom = 0
nom = 0
for r in resources:
nom += r
denom += r * r
nom = nom * nom
denom = len(resources) * denom
return nom/denom
In [3]:
for example_of_resources in examples_of_resources :
print(get_jain(example_of_resources))