def 密度(params):
    J = 0
    K = 0
    for 割合,量 in params:
        K += 量
        J += 量*割合
    J /= K
    return J
print(密度([(0.1,100)]*2))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: