def degre(matrice): d = [] for ... in ...: cpt = 0 for ... in ...: cpt = cpt + ... d.append(cpt) return d