• + 1 comment

    Can someone help me find the error here? It keeps returning Berry and Tina

    names = []
    scores = []
    
    if __name__ == '__main__':
        for _ in range(int(input())):
            name = input()
            score = float(input())
            names.append(name)
            scores.append(score)
    
    scores = sorted(scores)
    
    min_score = min(scores)
    
    scores_without_min = [s for s in scores if s != min_score]
    
    second_lowest_score = min(scores_without_min)
    
    names_with_second_lowest_score = []
    for name, score in zip(names, scores):
        if score == second_lowest_score:
            names_with_second_lowest_score.append(name)
    
    names_with_second_lowest_score.sort()
    
    for name in names_with_second_lowest_score:
        print(name)