Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Tuple basics
8. The in operator
Tuples in functions


Good job! To check if a value is present in a tuple, you can use the in operator:

user_data = ('John', 'Smith', 29, 1.85, 'British')
if 'British' in user_data:
  print('We\'ve got a British citizen!')
  print('We don\'t have a British citizen.')

In the code above, we check if the user_data tuple contains the string 'British'.


The train_connections variable is a list of tuples. Count the number of train connections that contain the string 'Paris'. Then, print the following information:

There are {x} train connections from/to Paris.

Stuck? Here's a hint!

Iterate over the list using:

for item in train_connections:

Then, use the in operator to check if a given item (tuple) contains 'Paris'.