Who Left, Who Joined

Python for AIMedium+10 XP+10

Who Left, Who Joined

A book club keeps a member list each month. last_month and this_month are lists of names.

Task: write member_changes(last_month, this_month). Return a tuple of two lists:

  1. the people who left — on last month's list but not this month's,
  2. the people who joined — on this month's list but not last month's.

Each list should be sorted alphabetically, with each name once. Either list can be empty.

Examples

last_month = ["ana", "bo", "cy"]
this_month = ["bo", "cy", "dee", "eli"]
returns [['ana'], ['dee', 'eli']]
last_month = ["ana"]
this_month = ["ana"]
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