Sort List of List in Python based on days of the week
I have a list of daily temperature, shown below:
weekly_temperature = [['Saturday', 100], ['Wednesday', 95], ['Friday', 80],
['Monday', 95], ['Sunday', 90], ['Tuesday', 100], ['Thursday', 85]]
How do I sort this list based on days of the week, starting from Monday to Sunday?
I would like the sorted output to look like below:
weekly_temperature = [['Monday', 95], ['Tuesday', 100], ['Wednesday', 95],
['Thursday', 85], ['Friday', 80], ['Saturday', 100], ['Sunday', 90]]
Comments
Post a Comment