Intro
bla bla
Enoncé
Correction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
matrice=[[0,0,0,1,0,0,0,0,0,0,0,1,0,0], [0,0,0,1,0,0,0,0,0,0,0,0,0,0], [0,0,0,1,0,0,0,0,0,0,0,0,0,0], [1,1,1,0,0,0,0,0,0,1,0,0,0,0], [0,0,0,0,0,1,0,0,0,0,0,0,0,0], [0,0,0,0,1,0,1,1,0,1,0,0,0,0], [0,0,0,0,0,1,0,0,0,0,0,0,0,0], [0,0,0,0,0,1,0,0,1,0,0,0,0,0], [0,0,0,0,0,0,0,1,0,0,0,0,0,0], [0,0,0,1,0,1,0,0,0,0,0,0,1,0], [0,0,0,0,0,0,0,0,0,0,0,0,1,0], [1,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,1,1,0,0,1], [0,0,0,0,0,0,0,0,0,0,0,0,1,0]] def mystere(matrice): compteur = 0 nombre_lignes = len(matrice) nombre_colonnes = len(matrice[0]) for i in range(nombre_lignes): for j in range(nombre_colonnes): if matrice[i][j] == 1: compteur = compteur + 1 return compteur |