On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Set basics
10. Using the in operator with sets
Relationships between sets


Well done! You can also check if an element is present in a set using the in operator. Let's see how this works:

favorite_movies = {'Halloween', 'A Star Is Born', 'Hocus Pocus'}

if 'Halloween' in favorite_movies:
  print('Excellent! I love "Halloween" too!')

In the code above, we check for the string 'Halloween' inside the favorite_movies set.


We've got a few newcomers to the XYC Corp.! Some of them work in the new branch, while some don't. You are now given two variables:

  • new_branch_employees – a set you already know well,
  • newcomers – a list of all the new employees in XYC Corp.

Your task is to calculate how many of these new employees work in the new branch and print the following:

{x} out of {y} newcomers work in the new branch!

Stuck? Here's a hint!

Iterate over the newcomers list. For each element, use the in operator to check if it exists in the set.