We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Find the Runner-Up Score!
Find the Runner-Up Score!
Sort by
recency
|
8066 Discussions
|
Please Login in order to post a comment
n = int(input()) arr = map(int, input().split()) print (sorted(set(arr))[-2])
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)
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)
Guys,i have a simple code for that :-
**May God fulfill all your dreams.