Excellent! Elements in a list are indexed (numbered), and you can get a specific item in the following way:
# define a list
canadian_cities = [
'Toronto', 'Montreal', 'Calgary',
'Ottawa', 'Edmonton', 'Mississauga',
'Winnipeg', 'Vancouver', 'Brampton', 'Familton']
# access Ottawa
We provide list name (
canadian_cities), followed by a pair of square brackets. Inside, we put the index (number) of the specific element. This way, we can access any element in the list.
List indices start at 0, not 1. In other words,
canadian_cities is the first element, and
canadian_cities – the fourth element. This is a common mistake among beginners, so watch out!