Video 6: Lists Tuples Dictionaries (page 2 of 14) |
The items in a list may be duplicated. For instance,
my_list = [1, 'hello', 1, 'hello']
The items in a list are indexed starting with 0. Therefore, the first item has an index of [0], the second item has an index of [1], and so on.
my_list = ['orange', 'cherry', 'grapes']
print(my_list[0]) # Print orange - item in 0th indexed position
The items in a list are mutable (changeable), For instance,
my_list[0] = 'apple' # change orange to apple