May-13-2020, 08:57 PM
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)]