I have two lists.
The first list is already sorted (by some other criteria) in such a way that the sooner the list is, the better.
sortedList = ['200', '050', '202', '203', '206', '205', '049', '047', '042', '041', '043', '044', '046', '045', '210', '211', '306', '302', '308', '309', '311', '310', '221', '220', '213', '212']
The second list is a list of valid values:
allowedList = ['001','002','003','004','005','006','007','008','009','010','203','204','205','206','207','212','213','215','216']
I would like to select the highest sorted value that exists in allowList, and I only come up with silly ways to do this. Such things:
import numpy as np temp = [] for x in allowedList: temp.append(sortedList.index(x)) np.min(temp)
There must be a better way than that. Any ideas?