Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Set basics
8. The clear() method
Relationships between sets
Summary

Instruction

Good work! You can also delete all elements from a set using clear(), as shown below:

favorite_movies = {'Halloween', 'A Star Is Born', 'Hocus Pocus'}
favorite_movies.clear()

After invoking clear(), favorite_movies will be an empty set.

Exercise

Well, it looks like the new branch wasn't particularly lucky in terms of employees – everyone was fired. Clear the set.

Stuck? Here's a hint!

Simply use:

new_branch_employees.clear()