Find the Runner-Up Score!

Sort by

recency

|

8066 Discussions

|

  • + 0 comments

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

  • + 0 comments
    arr.sort(reverse = True)
        length = len(arr)``
        runner_up=""
        if length > 1:
            for i in range(n):
                if arr[i] != arr[i+1]:
                    runner_up=arr[i+1]
                    break
        print(runner_up)
    
  • + 0 comments

    arr.sort(reverse = True) length = len(arr) runner_up="" if length > 1: for i in range(n): if arr[i] != arr[i+1]: runner_up=arr[i+1] break print(runner_up)

  • + 0 comments

    sort_score = (set(arr)) #converteed to set to eliminate dup values score = list(sort_score) #type cast to list so we can use sort fun and sliceing score.sort() #sort the list runner_up = score[-2] #get the last second value

    print(runner_up)

  • + 0 comments

    Guys,i have a simple code for that :-

    n = int(input())
    arr = map(int, input().split())
    arr =list(set(arr))                        #list(set()) is used for eliminating numbers     arr=sorted(arr)                         #sorted() is used for ascending order 
    print(arr[-2])                              #[-2] for last second number
    

    **May God fulfill all your dreams.