def f(L):
    # L est une liste de la forme [ (x1,n1) , (x2,n2) , ... , ]
    somme_produits = 0
    effectif_total = 0
    for x in L: # on parcourt la liste L --> x est un couple de nombres de la forme ( x[0], x[1] )
        somme_produits = somme_produits + x[0]*i[1]
        effectif_total = effectif_total + x[1]

    return somme_produits / effectif_total
