To sort a list of tuples, use the sort() method and pass in the key parameter to indicate which item to sort by.
sort()
key
Simplify Nested Structures with Python Data Classes
Simplify Object Creation with Python Class Methods
Optimizing Memory Usage in Python with Slots