Video 6: Lists (page 3 of 14) |
The items in a list do not all have to have the same data type. We may store an integer in the 0th index position, a string in the 1st index position, a float in the 2nd index position, another list in the 3rd index position, and so on. For instance,
stuff = ['house', 23, 23.8, 'clothes', [4, 7], [4, 'bill']]
We may add items to a list.
evens = [2, 4, 6, 8, 10]
evens.append(12) # Append the 12 to the last position (at the end of the list)