Sorting Lists By (Condition A, Condition B) In Python
Published in
3 min readMay 5, 2024
We can sort lists by custom conditions, but what if 2 elements are “equal” in this condition? In this case, we would need to specify an additional sorting condition.
A simple example — math scores
students = [
{'name': 'adam', 'score':70, 'height':181},
{'name': 'beth', 'score':90, 'height':161},
{'name': 'carl'…