Only on One List

Python for AIMedium+10 XP+10

Only on One List

Two teachers each wrote down the students they think should get an award. They want to talk about the names they disagree on.

Task: write on_one_list(list_a, list_b). Return the names that appear on exactly one of the two lists — on list_a but not list_b, or on list_b but not list_a. Return each once, in a list sorted alphabetically.

If they agree completely, return [].

Examples

list_a = ["ana", "bo", "cy"]
list_b = ["bo", "dee"]
returns ['ana', 'cy', 'dee']
list_a = ["eli"]
list_b = ["eli"]
returns []

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run