samedi 17 août 2019

If statement is not working in python 3.6

i'm trying to obtain values from list X whose labels are in list y when I use if condition to get values for label 5,3,1 it works but for label 0,2,4,7 it doesn't work i have labels from 0-7 when i count values for label 0,2,4,7 it gives me no of values.

ariel_pics=[]
hugo_pics=[]
tony=[]
for i in y:
    if y[i]==5:
       hugo_pics.append(X[i])

    if y[i]==0:
       ariel_pics.append(X[i])   
n=list(y).count(0)
print(n)

Aucun commentaire:

Enregistrer un commentaire