0

Question about lists and student grades

If I have a list like this: students = ["Harry", 37.21], ["Berry", 37.21], ["Tina", 37.2], ["Akriti", 41],["Harsh",39] how can I print out the name of the students with the second-lowest grades OUTPUT: Barry Harry

6th Dec 2019, 5:31 PM
Eda Bozkurt
Eda Bozkurt - avatar
8 Réponses
+ 2
you guys attending the same class ? https://www.sololearn.com/Discuss/2090911/?ref=app
6th Dec 2019, 5:36 PM
Taste
Taste - avatar
+ 2
Turkiyeeee <3
6th Dec 2019, 5:44 PM
Eda Bozkurt
Eda Bozkurt - avatar
+ 1
Türler sololearn kullanır mıydı ya🇹🇷🇹🇷🇹🇷
6th Dec 2019, 5:33 PM
Jupiter
Jupiter - avatar
+ 1
Html mi kullancan
6th Dec 2019, 5:34 PM
Jupiter
Jupiter - avatar
+ 1
What Taste
6th Dec 2019, 5:37 PM
Jupiter
Jupiter - avatar
+ 1
they have exactly same data in their question
6th Dec 2019, 5:38 PM
Taste
Taste - avatar
+ 1
this is the code I have but I do not understand after the comment I have placed. specifically this line : for x in range (len(score_list)-2,-1,-1): students = [[37.21,"Harry"], [ 37.21,"Berry"], [ 37.2,"Tina"], [41,"Akriti"],[39,"Harsh"]] students.sort(reverse=True) print (students) score_list = [] for sublist in students: score_list.append(sublist[0]) print (score_list) #dont understand underneath this: a=0 for x in range (len(score_list)-2,-1,-1): if min(score_list) != score_list[x]: a = score_list[x] break print(a) empty_list = [] for i in students: if i[0] == a: empty_list.append(i[1]) empty_list.sort() print(empty_list) for x in empty_list: print(x)
6th Dec 2019, 5:44 PM
Eda Bozkurt
Eda Bozkurt - avatar
0
Yes
6th Dec 2019, 5:39 PM
Jupiter
Jupiter - avatar