Merge Watchlists In Place

Medium ⏱ 12 min 48% acceptance ★★★★★ 4.5
Write merge_watchlists(main, *others) that folds every extra watchlist (iterables of show titles) into the set main in place using update operations, then returns the same set object (verify with is that no new set was created).

Examples

Example 1
Input
s = {'Dark'}; merge_watchlists(s, ['Ozark'], ['Dark', 'Suits']) is s
Output
True
Explanation

The original set object now holds {'Dark', 'Ozark', 'Suits'}.

Constraints

  • Do not rebind main to a new set.
  • Accept any number of extra iterables.

Topics

Setsin-place update

Companies

NetflixApple

Hints

Hint 1

set.update() accepts any iterable and mutates in place.

Hint 2

*others collects the variadic arguments.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.