Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Tuple basics
2. Defining tuples
Tuples in functions


A tuple is a data structure that's similar to a list: both are used to store multiple values in a single variable. In practice, lists are typically homogeneous (storing values of a single type), while tuples may be heterogeneous (storing values of multiple types). Take a look:

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

We created a new tuple with five elements. Three of them are strings ('John', 'Smith' and 'British'), one is an integer (29), and one is a float (1.85). Python knows that user_data is a tuple because we used commas to separate the elements. We can also add optional parentheses around the values:

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

Although the parentheses are optional, it's a good practice to use them around tuples.


Create a tuple named train_connection with the following items:

  1. 'Paris'
  2. 'Lyon'
  3. 393
  4. 45.00

Mind the order of items.

Stuck? Here's a hint!

Separate the items with commas to create a tuple.