0
Python indexing
I want to sort the array and get the Index of the elements from its original array , I couldn't think of any logic but I have tried something. https://code.sololearn.com/ckD70K4SE25f/?ref=app
5 Answers
+ 4
Loniie and it's working!
I thought of using for loop and then storing index of each item(from smt) in mt to a list but since the list mt list has repeated elements, it always gives the index of first occurrence and hence not a good one.
+ 2
print(sorted(enumerate(mt), key=lambda x:x[1])[::-1])
+ 1
https://code.sololearn.com/ct4Mf17IDc1S/?ref=app Diego here in the example the order of first two elements must be 9 and 11. Same for 56
+ 1
Thanks Anna