First and second place
Write code · Medium · §3.1 Finding ranks
You are given a list of student names names and a list of scores scores. The score of student names[i] is scores[i].
Complete the function solution, which returns a list of the names of the first-place and second-place students, in that order. No two scores are the same.
Function
solution(names, scores)
Constraints
namesandscoreshave the same length, which is from 2 to 1,000.- Each score is an integer from 0 to 1,000,000, and all scores are different.
Examples
| names | scores | result |
|---|---|---|
['Minjun', 'Seoyeon', 'Jiho'] | [70, 95, 88] | ['Seoyeon', 'Jiho'] |
['a', 'b'] | [1, 2] | ['b', 'a'] |
Starter code
def solution(names, scores):
answer = []
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.