bharat_r
In the zone
Hello
I have created a multidimensional list in python
I used the following code:
I tried sorting it in ascending order using r.sort()
and I get [(5, 6), (100, 2), (300, 4)]
I want it to get sorted based on each on the 2nd element instead of the first. That is the result should be [(100,2), (300,4), (5,6)]
How do I go about doing this?
Thank you.
I have created a multidimensional list in python
I used the following code:
Code:
r =[(300, 4), (5, 6), (100, 2)]
I tried sorting it in ascending order using r.sort()
and I get [(5, 6), (100, 2), (300, 4)]
I want it to get sorted based on each on the 2nd element instead of the first. That is the result should be [(100,2), (300,4), (5,6)]
How do I go about doing this?
Thank you.