-1

I want to know the index of maximum element in list "b", considering list "a" which shows the available indexes of list "b". For example:

a = [1,3,4]
b = [20,15,13,60,50,40]

so considering maximum value among (15, 60, 50) the outcome must be the 3 (the index of element 60 in list b).

Leila
  • 25
  • 4

1 Answers1

6

Use the key argument for max:

max(a,key = lambda i: b[i]) #3
John Coleman
  • 51,337
  • 7
  • 54
  • 119