Method # 1: Using sort ()
twice
The first approach that comes to mind is — this is a general way to use the sort function twice, first based on value and then based on the size of the list.

Exit:
The original list is: [[1, 4, 3, 2], [5, 4, 1], [1, 4, 6, 7]]
The list after sorting by value and length [[5, 4, 1], [1, 4, 3, 2], [1, 4, 6, 7]]
Method # 2: Using a lambda function
The above method calls the same sort function twice, but as an improvement, this method calls the sort function only once and uses a lambda function to do both sorts in one go.

Output:
The original list is: [[1, 4, 3, 2], [5, 4, 1], [1, 4, 6, 7]]
The list after sorting by value and length [[5, 4, 1], [1, 4, 3, 2], [1, 4, 6, 7]]