Dictionaries and counting · Python exercise
Read names and scores, then print the highest-scoring student.
The first line contains n. The next n lines each contain a name and an integer score separated by a space. Print the name and score of the highest-scoring student. If several students tie, choose the one that appears first.
Example 1
Input
3 Ada 90 Grace 95 Linus 88
Output
Grace 95
Example 2
Input
2 Sam 70 Alex 70
Output
Sam 70
Sam appears first.
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.