In this HackerRank Find the Runner-Up Score!, problem we have given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up.

HackerRank Find the Runner-Up Score! in python problem solution

HackerRank Find the Runner-Up Score! in python problem solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
import fileinput
data = []
for i in fileinput.input():
    data.append(map(int, i.split()))
array = data[1]
array.sort()
biggest = array[-1]
for i in xrange(len(array)-2, -1, -1):
    if array[i] != biggest:
        print array[i]
        break

Second solution

N = int(input())
A = [int(x) for x in input().strip().split(' ')]

found = False
for x in range(100,-101,-1) :
    if found :
        if x in A :
            print(x)
            break
    else :
        if x in A :
            found = True