Created
June 18, 2021 18:53
-
-
Save sithu/f26e9440b3e9a215ed85f7f956a3d859 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# Prompt the user to enter the number of students | |
numOfStudents = sys.stdin.readline() | |
print("number of students = " + numOfStudents) | |
maxScore = 0 | |
topStudent = None | |
for i in range(int(numOfStudents)): | |
line = sys.stdin.readline() | |
name, score = line.split(',') | |
if int(score) > maxScore: | |
maxScore = int(score) | |
topStudent = name | |
print("Top student " + topStudent + "'s score is " + str(maxScore)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
score.txt
########
4
Foo,10
Bar,20
Hello,100
World,50
########