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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
import numpy as np
#===========================
# TABLEAU 2D Lignes/Colonnes
#===========================
# TABL Lignes // Colonnes
lignes = 40
colonnes = 80
# ALEATOIRE entre 1 et 0
# Remplir Tableau(lignes,colonnes)
tbl1 = np.random.randint(2, size=(lignes,colonnes))
#
base = colonnes
total=0
max=4 #
n1 = base-2
n2 = base-1
n3 = base
print"==========="
#
for i in range(1,n1):
#index1=[]
index1= np.argwhere(tbl1[0:,i]== 1)
for j in range(i+1,n2):
#index2=[]
index2= np.argwhere(tbl1[index1,j]== 1)
#for b in index1:
# if tbl1[b,j] == 1:
# index2.append(b)
for k in range(j+1,n3):
total = 0
for c in index2:
if tbl1[c,k] == 1 :
total=total+1
if total > max :
max = total
print "Ocurrences des Valeurs Suivantes =","B1 =",(i),"B2 =",(j),"B3 =",(k),"Apparition= ",(total) |
Partager