jeudi 12 août 2021

Why I can't get the right result using 'if A or B' function in python [duplicate]

scores = [[100,90,98,88,65],[50,45,99,85,77]]

for i in range(len(scores)):
    for j in range(len(scores[0])):
        if scores[i][j] != min(scores[i]) or scores[i][j] != max(scores[i]):
            print (scores[i][j])
Result
100
90
98
88
65
50
45
99
85
77

I want to delete 100(the max value of the first row) and 45(the min value of the second row). But it doesn't work I think there's a problem with 'or' function. but I don't know what it is.

Aucun commentaire:

Enregistrer un commentaire