I want to sort my list based on the first item such as:
fruits = \
[['Mango', 6, 5, 8.0],
['Banana', 2.0, 5, 8.9, 7],
['Pineapple', 4, 6.8, 9],
['Apple', 3.9, 6, 7, 2]]
to be sorted out like this:
fruits = \
[['Apple', 3.9, 6, 7, 2],
['Banana', 2.0, 5, 8.9, 7],
['Mango', 6, 5, 8.0],
['Pineapple', 4, 6.8, 9]]
I know I have to use sort()
function but I don't know how to use it in a right way to produce the outputs that I want.