Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Tuple basics
7. Iterating over tuples
Tuples in functions
Summary

Instruction

Very well done! To iterate over a tuple, you can use a for loop:

user_data = ('John', 'Smith', 29, 1.85, 'British')
for item in user_data:
  print(item)

This uses a simple for loop to print each item of the tuple on a new line.

Exercise

For each item in the train_connection tuple, print the following line:

Train connection data of type {x} found: {item}

Replace {x} with the method call type(item).

Stuck? Here's a hint!

Inside the for loop, use:

print('Train connection data of type', type(item), 'found:', item)