Introduction
Tuple basics
4. Accessing elements
Tuples in functions
Summary

Instruction

Perfect! Tuples, like lists, use square brackets for accessing elements:

user_data = ('John', 'Smith', 29, 1.85, 'British')
user_data[1]

The code above will return 'Smith', the second element of the tuple. This is because tuples, like dictionaries, start their indexes at 0.

Exercise

Print the ticket price (the last element) from the train_connection tuple.

Stuck? Here's a hint!

The last element has an index of -1.