Find the Runner-Up Score!

Sort by

recency

|

8446 Discussions

|

  • + 0 comments
    n = int(input())
    arr = map(int, input().split())
    score_list = list(arr)
    runner_up = [x for x in score_list if x<max(score_list)]
    print(max(runner_up))
    
  • + 0 comments
    n = int(input())
    arr = map(int, input().split())
    arr = sorted(list(set(arr)))
    max_score = arr[-1]
    i = len(arr) - 1
    while max_score == arr[i]:
        i -= 1
    print(arr[i])
    
  • + 0 comments
    if __name__ == '__main__':
        n = int(input())
        arr = list(map(int, input().split()))
        arr = list(set(arr))
        arr.sort()
        print(arr[-2])
    
  • + 0 comments
    # More beginner friendly
    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        lst_arr = list(arr)
        # Logic
        max = -100
        second_max = -100
        if (n>=2 and n<= 10):
            for i in range(n):
                if(lst_arr[i] >= -100 and lst_arr[i] <= 100):
                    if(i==0):
                        max = lst_arr[i]
                    else:
                        if(lst_arr[i]> max):
                            second_max = max
                            max = lst_arr[i]
                        elif(lst_arr[i] < max and lst_arr[i] > second_max):
                            second_max = lst_arr[i]
                else:
                    exit
                #print(f"loop no: {i+1}")
                #print(f"max : {max} and second_max : {second_max}")
            print(second_max)
        else:
            exit
    
  • + 1 comment
    #for beginner this my be the simplest code
    if __name__ == '__main__':
        n = int(input())
        arr = list(map(int, input().split())) #adding 'list' keyword 
        max_list = max(arr) #finding the max of arr
        li=[]    
        for i in arr:
            if i != max_list: #removeing the largest value 
                li.append(i)
        sec_max = max(li)
        print(sec_max)
    * >     ``