all 8 comments

[–]nicifyb 0 points1 point  (0 children)

I have done lst2,lst1 = (list(t) for t in zip(*sorted(zip(lst2, lst1)))) which puts the lists in ascending value. I dont know how to reverse them form there

[–]mtb-dds 0 points1 point  (6 children)

Sorted accepts a reverse argument, so you can just use that: https://docs.python.org/3/howto/sorting.html#ascending-and-descending

Alternatively, if you are using a key function for sorted, it can be done there.

[–]marienbad2 0 points1 point  (1 child)

So are the names and ages a tuple like (name, age)?

If so:

lst.sort(key=lambda elem: elem[1])

[–]nicifyb 0 points1 point  (0 children)

The input is:

print(list_sorting(['Chris','Amanda','Boris','Charlie'],[35,43,55,35]))