I made a simple code to find the highest value out of various lists of numbers
lists = [[1,-3,5,2,6,11,78,5,-345,-3,6,98,-5,0],[1,2,3,4,5,6,7,6,5,4,4],[-435,-64,-4,-6,-45,-8,-98,-7,-8],[32,45,56,554,12,33]]
for w in lists:
lst = w
a = float ("-inf")
for x in range (0, len (lst)):
b = lst [x]
if (b > a):
a = b
c = x
z = lst
print ("The list is:",z)
print ("The highest value is: " , a)
print ("The position is:", c+1)
Out:
The list is: [32, 45, 56, 554, 12, 33]
The highest value is: 554
The position is: 4
But how can I know the second, third and so on??
I'm looking for something like this:
Out:
The list is: [1,-3,5,2,6,11,78,5,-345,-3,6,98,-5,0]
The second highest value is: 98
The position is: 12