Title: Nesting Lists
Slug: nesting_lists
Summary: Nesting Lists
Date: 2016-05-01 12:00
Category: Python
Tags: Basics
Authors: Chris Albon


In [8]:
# Create a list of three nested lists, each with three items
state_regions = [['California', 'Oregon', 'Washington'],
        ['Texas','Georgia','Alabama'],
        ['Maine','Vermont','New York']]

In [9]:
# View the list
state_regions


Out[9]:
[['California', 'Oregon', 'Washington'],
 ['Texas', 'Georgia', 'Alabama'],
 ['Maine', 'Vermont', 'New York']]

In [10]:
# Print the second list's third item
state_regions[1][2]


Out[10]:
'Alabama'