Find the Runner-Up Score in Python HackerRank Solution

Find the Runner-Up Score - Python HackerRank Solution

Hello Friends, How are you? Today I am going to solve the HackerRank Find the Runner-Up Score Problem in Python with a very easy explanation. In this article, you will get one or more approaches to solving this problem. So let's start-

{tocify} $title={Table of Contents}

Default Arguments Python HackerRank Solution

HackerRank Python Find the Runner-Up Score Solution - Problem Statement

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.

Input Format

The first line contains n. The second line contains an array A[] of n integers each separated by a space.


3 <= n <= 10
-100 <= A[i] <= 100

Output Format:

Print the runner-up score.

Sample Input 0

5 2 3 6 6 5 {codeBox}

Sample Output 0

5 {codeBox}


The given list is [2, 3, 6, 6, 5]. The maximum score is 6, the second maximum is 5. Hence, we print 5 as the runner-up score.

Python Find the Runner-Up Score - Hacker Rank Solution

Approach I: Find the Runner-Up Score HackerRank Python Solution

# ========================
#       Information
# ========================

# Name: Find the Runner-Up Score in Python HackerRank
# Direct Link:
# Difficulty: Easy
# Max Score: 10
# Language: Pypy 3

# ========================
#         Solution Start
# ========================

#Find the Runner-Up Score in Python - Hacker Rank Solution
if __name__ == '__main__':
    n = int(input())
    arr = map(int, input().split())
#Find the Runner-Up Score in Python - Hacker Rank Solution END
# MyEduWaves

Disclaimer: The above Problem ( Python Find the Runner-Up Score ) is generated by Hackerrank but the Solution is Provided by MyEduWaves. This tutorial is only for Educational and Learning purposes. Authority if any queries regarding this post or website fill out the contact form.

I hope you have understood the solution to this HackerRank Problem. All these three solutions will pass all the test cases. Now visit Python Find the Runner-Up Score Hackerrank Problem and try to solve it again.

All the Best!

Post a Comment

Previous Post Next Post