Creation and use of Lists/Tuples

--Originally published at Start in the world of the #TC101

Two of the most commonly used built-in data types in Python are the list and the tuple.

Lists and tuples are part of the group of sequence data types—in other words, lists and tuples store one or more objects or values in a specific order. The objects stored in a list or tuple can be of any type, including the nothing type defined by the None keyword.

The big difference between lists and tuples is that lists are mutable, however tuples are immutable. Meaning once tuples are created, objects can’t be added or removed, and the order cannot be changed. However, certain objects in tuples can be changed, as we’ll see later.

Creating a Python List or Tuple

Creating a list or tuple is easy, here are some empty ones:

 

*To create non-empty lists or tuples, values are separated by comma

*To create a tuple with only one value, add a trailing comma to the value.

Example:

 

Source: http://pythoncentral.io/python-lists-and-tuples/