I have two lists in python of same length:
listA = [7,6,3,2,1,4,5]
listB = [a,b,c,d,e,f,g]
is their some way (probably easy function) to sort listA and change the values of listB in the same way. Means
listA_new = [1,2,3,4,5,6,7]
and
listB_new = [e,d,c,f,g,b,a]
same question about remove duplicates. E.g. if I have some list
listC = [1,1,4,4,5,6,7]
and
listD = [a,b,c,d,e,f,g]
the result should be:
listC_new = [1,4,5,6,7]
and
listD_New = [a,c,e,f,g]
Try this:
Output:
for supporting C and D (removing duplicates):
.values()returns ListD:['a', 'c', 'e', 'f', 'g']and.keys()returns ListC:[1, 4, 5, 6, 7]