Skip to content

Instantly share code, notes, and snippets.

@sithu
Created June 18, 2021 18:53
Show Gist options
  • Save sithu/f26e9440b3e9a215ed85f7f956a3d859 to your computer and use it in GitHub Desktop.
Save sithu/f26e9440b3e9a215ed85f7f956a3d859 to your computer and use it in GitHub Desktop.
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))
@sithu
Copy link
Author

sithu commented Jun 18, 2021

score.txt
########
4
Foo,10
Bar,20
Hello,100
World,50
########

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment