manyspikes

Lists and tuples

Initialising environment...

Lists are defined by enclosing a series of comma-separated values in square brackets [...]. If no values are specified within the square brackets, the list is empty. Let's define a list to hold a sequence of values:

a = [1, 2.0, "Three"]

Tuples are defined in a similar fashion, but using parenthesis (...) instead:

b = (1, 2.0, "Three")

As you can see above, both lists and tuples can contain values of different types.

Instructions

Create a list containing the integer values 1, 2, 3, in this order, and assign it to a variable called n_list.

Equally, create a tuple containing the same values, in the same order, and assign it to a variable called n_tuple.