Find the Runner-Up Score!

  • + 13 comments

    Great solution. You could also do away with the 'i' variable and the while loop by replacing them with a for loop.

    n = int(input())
    arr = list(map(int, input().split()))
    largest = max(arr)
    
    for i in range(n):
        if largest == max(arr):
            arr.remove(max(arr))
    
    print(max(arr))
    

    edit: fixed logical error