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
|
8113 Discussions
|
Please Login in order to post a comment
h= float('-inf') for i in arr: if i >h : sh =h h=i elif(i>sh and h!=i): sh=i print(sh)
This is much better
if name == 'main': n = int(input()) arr = list(map(int, input().split()))
if name == 'main': n = int(input()) arr = map(int, input().split()) score = list(arr) winner = max(score) runnerup = max([x for x in score if x!=winner]) print(runnerup)