Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Find the second lowest grade of any student(s) from the given names and grades of each student using lists

if __name__ == '__main__':
    single_list=[]
    nested_list=[]
    score_list=[]
    for _ in range(int(input())):
        name = input()
        score = float(input())
        score_list.append(score)
        nested_list.append([name,score])
    nested_list=sorted(nested_list)
    sorted_score=sorted(score_list)
    minNumber=sorted_score[0]
    for score in sorted_score:
        if score>minNumber:
            second_less=score
            break
    
    for single in nested_list:
        if single[1]==second_less:
            print(single[0])
          
     
     
        
 
PREVIOUS NEXT
Tagged: #Find #lowest #grade #names #grades #student #lists
ADD COMMENT
Topic
Name
7+3 =