• [^] # Re: pythonicité

    Posté par . En réponse au message Problème affectation liste de liste - boucles imbriquées. Évalué à 5.

    Par rapport au titre de mon commentaire, un code un peu plus idiomatique serait le suivant (mais on peut sans doute apporter d'autres améliorations) :
    ```
    combvp = [[15, 6, 3, 1, 75],
    [ 1, 0, 21, 1, 77]]

    fg7mw = [18.02, 44.01, 32, 39.94, 28.02]

    mw = [27.7, 28.5]

    combwp = [ [ combvp[i][j] * fg7mw[j] / mw[i] for j in range(len(combvp[0])) ] for i in range(len(mw)) ]
    ```