Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Tuple basics
5. Index slicing
Tuples in functions
Summary

Instruction

Good job! And, just like lists, tuples allow index slicing. The code below provides some examples with comments:

user_data = ('John', 'Smith', 29, 1.85, 'British')

user_data[1:3] # from index 1 (inclusive) until index 3 (exclusive)
user_data[1:]  # from index 1 onwards
user_data[:2]  # until index 2 (exclusive)

Exercise

Use slicing to print the following elements of the train_connection tuple: 'Lyon' and 393.

Stuck? Here's a hint!

You need the elements with indexes 1 and 2, so use [1:3].