salut,
je cherche à recupérer toute les lignes non dominantes d'une matrices. ( l'un des éléments de la ligne choisi soit supérieur)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
27 import numpy def maxelement(arr): no_of_rows = len(arr) no_of_column = len(arr[0]) for i in range(no_of_rows-1): for j in range(no_of_column-2): m=arr[i+1][j] n=arr[i+1][j+1] if arr[i+1][j] > m or arr[i+1][j+2] >n : m = arr[i][j] n = arr[i][j] print(m,n) arr = [[3, 4, 1, 8], [1, 4, 9, 11], [76, 34, 21, 1], [2, 1, 4, 5]]![]()
Partager