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
8 Answers
+ 2
you guys attending the same class ?
https://www.sololearn.com/Discuss/2090911/?ref=app
+ 2
Turkiyeeee <3
+ 1
TĂŒrler sololearn kullanır mıydı yađčđ·đčđ·đčđ·
+ 1
Html mi kullancan
+ 1
What Taste
+ 1
they have exactly same data in their question
+ 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)
0
Yes