Find the Runner-Up Score!

  • + 9 comments

    Your code will show error because when largest number is removed in one iteration, then the next number will be assigned it's index and thus it will become a mess. you could try this

    n = int(input())
    arr = list(map(int, input().split()))
        a = max(arr)
        for x in range(len(arr)-1,-1,-1):
                if arr[x] == a:
                        arr.remove(arr[x])
        print(max(arr))