Listas

- mixed list
- bounded list
- negative index goes backwards [bounded too!]
- list membership => x in list || x not in list
- list concatenation:

>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> c = a + b
>>> print c
[1, 2, 3, 4, 5, 6]

- list repetition

>>> [0] * 4
[0, 0, 0, 0]
>>> [1, 2, 3] * 3
[1, 2, 3, 1, 2, 3, 1, 2, 3]

- List slices

>>> a_list = ['a', 'b', 'c', 'd', 'e', 'f']
>>> a_list[1:3]
['b', 'c']
>>> a_list[:4]
['a', 'b', 'c', 'd']
>>> a_list[3:]
['d', 'e', 'f']
>>> a_list[:]
['a', 'b', 'c', 'd', 'e', 'f']

- List are mutable (not as strings...)

>>> fruit = ["banana", "apple", "quince"]
>>> fruit[0] = "pear"
>>> fruit[-1] = "orange"
>>> print fruit
['pear', 'apple', 'orange']

- List deletion

>>> a = ['one', 'two', 'three']
>>> del a[1]
>>> a
['one', 'three']

- Equality

>>> a = [1, 2, 3]
>>> b = [1, 2, 3]
>>> a == b
True
>>> a is b
False

- Aliasing

>>> a = [1, 2, 3]
>>> b = a
>>> a is b
True

>>> b[0] = 5
>>> print a
[5, 2, 3]

- Nested Lists

>>> nested = ["hello", 2.0, 5, [10, 20]]
>>> elem = nested[3]
>>> elem[0]
10
>>> nested[3][1]
20

- Matrixes

>>> matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> matrix[1]
[4, 5, 6]
>>> matrix[1][1]
5


