I'm a newbie . I have a problem .
That problem is how to sort a list objects in Python similar struct in C
Example: I have code:
class struct():
def __init__(self,first=0,second=0):
self.f=first
self.s=second
for i in range(1,n+1):
a[i]=struct()
a[i].f,a[i].s=map(int,input().split())
a.sort(key=???)
for i in range(1,n+1):
print(a[i].f," ",a[i].s)
and the test :
4 3
7 4
15 10
2 2
1 5
I want to sort the list a [i] .f in ascending order and if there are more a [i] .f , I want to sort the a [i] .s in descending order.
Please tell me the solution. Thank u for reading