Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 584c978

Browse files
Add files via upload
1 parent d80dcf1 commit 584c978

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

‎Find the Runner-Up Score!.py‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given
2+
3+
# scores. Store them in a list and find the score of the runner-up.
4+
5+
# Input Format
6+
7+
# The first line contains
8+
# . The second line contains an array of
9+
10+
# integers each separated by a space.
11+
12+
# Constraints
13+
14+
# Output Format
15+
16+
# Print the runner-up score.
17+
18+
# Sample Input 0
19+
20+
# 5
21+
# 2 3 6 6 5
22+
23+
# Sample Output 0
24+
25+
# 5
26+
27+
# Explanation 0
28+
29+
# Given list is
30+
# . The maximum score is , second maximum is . Hence, we print as the runner-up score.
31+
32+
if __name__ == '__main__':
33+
n = int(input())
34+
arr = map(int, input().split())
35+
36+
37+
listnew=[]
38+
39+
for i in arr:
40+
41+
if i not in listnew:
42+
43+
44+
listnew.append(i)
45+
46+
listnew.sort(reverse=True)
47+
48+
print(listnew[1])
49+
50+
51+
52+
53+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /