Find the Runner-Up Score!

Sort by

recency

|

8013 Discussions

|

  • + 0 comments

    arr.sort(reverse = True) largest = arr[0] for element in arr[1 :]: if element < largest: print(element) break

  • + 0 comments

    My code is the following

    n = int(input()) arr = set(map(int, input().split())) n_arr = list(arr) n_arr = sorted(n_arr) print(n_arr[-2])

    and there are two cases where I get errors, but when I run them from my computer they give me the expected results.

  • + 0 comments

    if name == 'main': n = int(input()) arr = map(int, input().split())

    arr = list(arr)
    
    maxscore = max(arr)
    newScore = []
    for score in arr:
        if score != maxscore:
            newScore.append([score])
    
    runnerUp = max(newScore)
    Result = runnerUp[0]
    
    print(Result)
    
  • + 1 comment

    if name == 'main':

    n = int(input())
    
    arr = list(map(int, input().split()))
    
    arr1 = [x for x in arr if x < max(arr)]
    
    print(max(arr1))
    
  • + 0 comments
    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        arr = sorted(arr) 
        for i in arr[::-1]:
            a = arr[::-1][0]
            if i < a:
                print(i)
                break
            else:
                a = i