Suppose I have a class named Fish. now I would ask for a user input to give the name and the size of the fish. now, How can I sort those input values by the size attribute(in decreasing order) and then the name attribute(alphabetically)?
class Fish:
def __init__(self, size, name):
self.size:int = int(size)
self.name:str = name
pass
def main():
t = input()
for example the user input the following:
d 3
a 1
c 2
b 1
after the sorting it should be: (it sorted first by the sizes then if the sizes are the same it sorted by the names)
d 3
c 2
a 1
b 1