lundi 20 février 2017

List manipulation to extract values greater than current and remaining index vlaues

I have following list:

et = [0.0, 632.8, 629.9, 626.5, 623.7, 620.7, 620.7, 607.4, 603.2, 602.0, 606.6, 613.2, 608.4, 599.7, 583.6]

Ideally it should be in descending order but 602.0 is smaller than next 3 values (606.6,613.2,608.4) and I need a count of those values each time this issue arises. I am trying nested for loops to count those values with following:

l = len(et)    
for i in xrange(1,l-1,1):
    for j in xrange(1,l-1,1):
        if (et[i] < et[j]):
            print et[i]

But instead I get all values greater than 602.0 How do I restrict loop to only count those 3 values? Appreciate any suggestions.

Aucun commentaire:

Enregistrer un commentaire