Dec-16-2017, 03:20 PM
Hello, i'm on a personnal project whose objective is to sort a list by name and not by first name.
However i have to keep the couple "name-firstname"
The user has to enter numbers in a list :
I have to do it with function too..
Thanks for help
However i have to keep the couple "name-firstname"
The user has to enter numbers in a list :
[0, 1]These numbers correspond to people who are in this list :
listepersonnes = [['RIETTE', 'JEAN', 'H', '28'], ['LAPORTE', 'LUCIE', 'H', '38']]I would like the result to be :
['LAPORTE', 'LUCIE'], ['RIETTE', 'JEAN']I have do it..
listepersonnes = [['RIETTE', 'JEAN', 'H', '28'], ['LAPORTE', 'LUCIE', 'H', '38']] listetrie = [] for i in range (len(listepersonnes)): listetrie.append(listepersonnes[i][0]) listetrie.sort() listetrie.append(listepersonnes[i][1]) print(listetrie)I really don't know how to do it....
I have to do it with function too..
Thanks for help