So I have a list like below:
points = [[0, 0], [5, 3], [0, 5], [0, 2], [1, 3], [5, 3]]
I have been using
points.sort(key=lambda pair: pair[0])
to sort the list. But this only sorts it by first value without looking at the second value.
The result of this code is as below:
[[0, 0], [0, 5], [0, 2], [1, 3], [5, 3], [5, 3]]
However, I want to sort is such that the result is:
[[0, 0], [0, 2], [0, 5], [1, 3], [5, 3], [5, 3]]
How do I do it?
Also, while we are at it, how do i remove the duplicates from this list? The final result should be like:
[[0, 0], [0, 2], [0, 5], [1, 3], [5, 3]]