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 :
These numbers correspond to people who are in this list :
I would like the result to be :
I have do it..
I really don't know how to do it....
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 :
1 |
[ 0 , 1 ] |
1 |
listepersonnes = [[ 'RIETTE' , 'JEAN' , 'H' , '28' ], [ 'LAPORTE' , 'LUCIE' , 'H' , '38' ]] |
1 |
[ 'LAPORTE' , 'LUCIE' ], [ 'RIETTE' , 'JEAN' ] |
1 2 3 4 5 6 7 8 |
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 have to do it with function too..
Thanks for help