13.2. Tuple Packing

Wherever python expects a single value, if multiple expressions are provided, separated by commas, they are automatically packed into a tuple. For example, we can omit the parentheses when assigning a tuple of values to a single variable.

Check your understanding

2. Create a tuple called practice that has four elements: ‘y’, ‘h’, ‘z’, and ‘x’.

3. Create a tuple named tup1 that has three elements: ‘a’, ‘b’, and ‘c’.

4. Provided is a list of tuples. Create another list called t_check that contains the third element of every tuple.

5. Below, we have provided a list of tuples. Write a for loop that saves the second element of each tuple into a list called seconds.

You have attempted of activities on this page