Python Problem- Find the Runner Up Score!!!

Problem

Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up.  

Source Code

n = int(input())
list1 = list(map(int,input().strip().split()))[:n]
list2 = list(set(list1))
list2.sort(reverse = True)
x = list2[1]
print(x)


Comments

Popular posts from this blog

THREE LEVELS OF DATA INDEPENDENCE

Python Syntax, Comments, Variables, Indentation

Python-HackerRank Problem List Comprehensions