End of Summer - hours only!Up to 80% off on all courses and bundles.-Close
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 lists, 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.