I'm new to Python, thus the question,
I have the following list of list items,
[[0, 1], [2,3], [1,2], [4, 5], [3, 5]]
I want to sort this list in increasing order comparing the second item of each list first and then the first item
This is my code,
def sorting(a, b):
if a[1] > b[1]:
return 1
elif a[1] == b[1]:
if a[0] > b[0]:
return 1
else:
return -1
else:
return 1
However can someone help me rewrite this using the sorted function with lambda and comprehensions.