Common interest tags

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

You are given a and b, the interest tag lists of two people. Complete the function solution, which returns a list of the tags that both people have, sorted in ascending order, the way sorted() sorts strings.

Even if the same tag appears several times in one person's list, include it only once.

Function

solution(a, b)

Constraints

Examples

abresult
['ai', 'music', 'travel', 'ai']['travel', 'food', 'ai']['ai', 'travel']
['cat']['dog'][]

Starter code

def solution(a, b):
    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.