I based my code on Duncan Betts' codes for my assignment but I don't understand it and it seems like it has been 3 years since he last logged on so I can't ask him.
Can you please explain where did the "studentrecord" code come from? What is it?
num = int(input("How many students?: "))
physics_students = [[input("Input student name: "),float(input("Input grade: "))] for studentrecord in range(num)]
physics_students.sort(key=lambda studentrecord: float(studentrecord[1]))
lowest_grade = physics_students[0][1]
ind = 0
while physics_students[ind][1] == lowest_grade:
ind += 1
second_lowest_grade = physics_students[ind][1]
second_lowest_students = []
while physics_students[ind][1] == second_lowest_grade:
second_lowest_students.append(physics_students[ind][0])
ind += 1
if ind == num:
break
second_lowest_students.sort()
print(*second_lowest_students, sep="\n")
Thank you so much for your help!