list collection is its built-in mutable sequence. We can create list objects easily using a literal display that simply provides expressions enclosed in
. It looks like this:
fib_list = [1, 1, 3, 5, 8]
As with tuples, the items are identified by their position in the
list collection. Positions are numbered from the left starting from zero. Positions are also numbered from the right, using negative numbers. The last value in a list is at position -1, the next-to-last value at position -2.
Index values begin with zero. Index position 0 is the first item. Index values can be done in reverse with negative numbers. Index position -1 is the last item.
We can also create lists using the
list() function. This will convert ...