First repeated ID

Write code · Basic · §4.1 Remembering what you have seen

ids holds IDs in the order the sign-up requests came in. Complete the function solution, which goes through ids in order and returns the first ID that has already appeared earlier in the list.

If no ID is repeated, return an empty string "".

Function

solution(ids)

Constraints

Examples

idsresult
['kim', 'lee', 'park', 'lee', 'kim']'lee'
['a', 'b']''

Starter code

def solution(ids):
    answer = ""
    return answer

Solve 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.