Sort by

recency

|

4739 Discussions

|

  • + 0 comments

    stored =[] s=set() for _ in range(int(input())): name = input() score = float(input()) stored.append([name,score]) s.add(score)

    low=sorted(s)[1]
    low_name=[]
    
    
    low_score =[ (name, score )for name, score in stored if score== low]
    
    
    
    
    for value in sorted(low_score):
        print(value[0])
    
  • + 0 comments

    The code check compares order ([a,b] != [b,a]) but this constraint is not mentioned in the problem description.

  • + 0 comments
    if __name__ == '__main__':
        
        name_list = []
        numbers = []
        for _ in range(int(input())):
            name = input()
            score = float(input())
            numbers.append(score)
            name_list.append([name, score])
        sort_by_numbers  = sorted(name_list, key=lambda name_list: name_list[1])
        
        #Input can have multiple lowest score... Creating new list to remove all lowest scores 
        low_list = [x for x in sort_by_numbers if x[1] > min(numbers)]
    
        final_name = [x[0] for x in low_list if x[1] == low_list[0][1] ]
        for x in sorted(final_name): print(x)
            
        
        
    
  • + 0 comments

    if name == 'main': n=int(input()) l=[] for _ in range(n): name = input() score = float(input()) l.append([name,score])

    grade_list=[]
    for student in l:
        grade=student[1]
        if grade not in grade_list:
            grade_list.append(grade)
    grade_list.sort()
    second_lowest=grade_list[1]
    for student in sorted(l):
        if student[1]==second_lowest:
            print(student[0])
    

  • + 0 comments
    if __name__ == '__main__':
        a = []         # list to store [name, score]
        s = set()      # set to store unique scores
    
        for _ in range(int(input())):
            name = input()
            score = float(input())
            a.append([name, score])
            s.add(score)
    
        slc = sorted(s)[1]  # second lowest score
        sln = []            # names with second lowest score
    
        for name, score in a:
            if score == slc:
                sln.append(name)
    
        for name in sorted(sln):
            print(name)