Python Forum
Sort on basis of (name,age,score)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort on basis of (name,age,score)
#9
Your problem is where you have the quotes in the string -
inlist = [('Tom',19,80),('John',20,90),('Jony',17,91),('Jony',17,93),('Json',21,85)]
print(sorted(inlist))
Output:
[('John', 20, 90), ('Jony', 17, 91), ('Jony', 17, 93), ('Json', 21, 85), ('Tom', 19, 80)]
Reply


Messages In This Thread
Sort on basis of (name,age,score) - by pyzyx3qwerty - May-12-2020, 09:49 AM
RE: Sort on basis of (name,age,score) - by anbu23 - May-12-2020, 09:54 AM
RE: Sort on basis of (name,age,score) - by Larz60+ - May-12-2020, 06:23 PM
RE: Sort on basis of (name,age,score) - by DeaD_EyE - May-13-2020, 12:00 PM
RE: Sort on basis of (name,age,score) - by jefsummers - May-13-2020, 08:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update score value? Mavoz 5 2,623 Nov-08-2022, 12:37 AM
Last Post: Mavoz
  how to sort a list without .sort() function letmecode 3 3,548 Dec-28-2020, 11:21 PM
Last Post: perfringo
  [split] Manual Sort without Sort function fulir16 2 3,268 Jun-02-2019, 06:13 AM
Last Post: perfringo
  Manual Sort without Sort function dtweaponx 26 49,582 Jun-01-2019, 06:02 PM
Last Post: SheeppOSU
  Average score MartinEvtimov 5 6,980 Apr-02-2017, 07:35 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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