Python Forum
Sort a list that is embedded
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort a list that is embedded
#3
Hello, sorry i'm french ahah :)
Your code is working correctly but he doesn't do the job i need ;)

 listpeople = [['RIETTE', 'JEAN', 'H', '28'], ['LAPORTE', 'LUCIE', 'H', '38']]
 
INPUT :
I ask to enter number or numbers for example it should do the job for: 0, 2
So I want the code to make sort from the 0 to the 2.

PROGRAM :

I have to make a function ( a definiton ) like this
def sortlist(INPUT):
 ????????????
 ????????????
OUTPUT :
It will sort the name of person like what you did past.

 [['LAPORTE', 'LUCIE'], ['RIETTE', 'JEAN']] 

Problem solved ;)with
 "return sorted([i[:2] for i in [maliste[j] for j in selection]])"
Reply


Messages In This Thread
Sort a list that is embedded - by Whisper40 - Dec-16-2017, 03:20 PM
RE: Sort a list that is embedded - by Mekire - Dec-16-2017, 03:52 PM
RE: Sort a list that is embedded - by Whisper40 - Dec-16-2017, 05:11 PM
RE: Sort a list that is embedded - by nilamo - Jan-23-2018, 06:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sort a list of dictionaries by the only dictionary key Calab 2 732 Apr-29-2024, 04:38 PM
Last Post: Calab
  list.sort() returning None SmallCoder14 8 794 Mar-19-2024, 09:49 PM
Last Post: SmallCoder14
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,393 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  list sort() function bring backs None CompleteNewb 6 4,294 Mar-26-2022, 03:34 AM
Last Post: Larz60+
  [solved] Sort list paul18fr 5 2,979 Aug-18-2021, 06:34 AM
Last Post: naughtyCat
  Sort List of Lists by Column Nju 1 13,458 Apr-13-2021, 11:59 PM
Last Post: bowlofred
  How to sort os.walk list? Denial 6 11,907 Oct-10-2020, 05:28 AM
Last Post: Denial
  Converting to a list and sort tantony 6 3,353 Oct-07-2019, 03:30 PM
Last Post: perfringo
  List sort - alphanumeric? papsphilip 2 2,544 Oct-05-2019, 09:27 PM
Last Post: papsphilip
  syntax error on list.sort() jjordan33 3 3,314 Jul-10-2019, 04:57 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020