How to sort a list in python using lambda


Topic: How to sort a list in python using lambda

Solution

data = [("Apples", 5, "20"), ("Pears", 1, "5"), ("Oranges", 6, "10")]
data.sort(key=lambda x:x[0])



List all Python Programs