Sort by

recency

|

4524 Discussions

|

  • + 0 comments

    Code For Beginners:

        marks=[]
        s=[]
        for _ in range(int(input())):
            name = input()
            score = float(input())      
            m=[]
            m.append(name)
            m.append(score)
            s.append(score)
            marks.append(m)
            
        s=list(sorted(set(s)))
        second_min=s[1]
        sec=[]
        for i in marks:
            if i[1]==second_min:
                sec.append(i[0])
        sec.sort()
        for i in sec:
            print(i)
    
  • + 0 comments
    if __name__ == '__main__':
        record = {}
        for _ in range(int(input())):
            name = input()
            score = float(input())
            record[score] = record.get(score, []) + [name]
            
        second_lowest = sorted(list(record.keys()))[1]
        for name in sorted(record[second_lowest]):
            print(name)
    
  • + 1 comment
    if __name__ == '__main__':
        records = []
        for _ in range(int(input())):
            name = input()
            score = float(input())
            records.append([name,score])
    # record and sort the grades of each student while removing the duplicates
        grades = sorted(list(set([record[1] for record in records])))
        
    # Finding the second lowest value
    second_lowest = grades[1]
    
    # Store and display the student names who has the second lowest scores
    students = sorted(record[0] for record in records if record[1] == second_lowest)
    for i in students:
        print(i)
    
  • + 0 comments
    if __name__ == '__main__':
        names,scores = [],[]
        for _ in range(int(input())):
            name = input()
            score = float(input())
            scores.append(score)
            names.append(name)
    print('\n'.join(sorted([name for name,score in dict(zip(names,scores)).items() if score==sorted(set(scores))[1]])))
    
  • + 0 comments

    l1=[] n=int(input()) for i in range(n): name = input() score = float(input()) score2 = f"{score:.2f}" l=[] l.append(name) l.append(score2) l1.append(l) l3=[] for i in range(n): l3.append(l1[i][1]) l3.sort() l4=[] for i in range(n): if(l3[2]==l1[i][1]): s=l1[i][0] l4.append(s) l4.sort() for i in l4: print(i)