Back
Consider the below list:
a = [32, 37, 28, 30, 37, 25, 27, 24, 35, 55, 23, 31, 55, 21, 40, 18, 50, 35, 41, 49, 37, 19, 40, 41, 31]
Here, the Highest element is 55
I want to discover in which position(s) the greatest value is arranged. Kindly, help.
Try the following code:
>>> m = max(a)>>> [i for i, j in enumerate(a) if j == m][9, 12]
>>> m = max(a)
>>> [i for i, j in enumerate(a) if j == m]
[9, 12]
Join the python online course fast, to learn python concepts in detail and get certified.
For more details, do check out the below video tutorial...
31k questions
32.8k answers
501 comments
693 users