How to find the index of the minimum and maximum values of an int array Python… here is a solution to the problem.
How to find the index of the minimum and maximum values of an int array Python
Hello, I want to find the first index of the maximum and minimum values of an integer array.
My code returns all indexes in case of duplicate values….
A= [1,1,8,7,5,9,6,9]
def minmaxloc(num_list):
for i,y in enumerate(num_list):
if y ==max(num_list) or y==min(num_list):
print i
minmaxloc(A)
Output:
0
1 pc
5 pcs
7
What I want:
(0,5)
Thanks for your help.