Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Nested List | List
Python Data Structures
course content

Course Content

Python Data Structures

Python Data Structures

1. List
2. Dictionary
3. Tuple
4. Set

bookNested List

Items within a Python list can also be lists, resulting in nested lists, sometimes referred to as "lists within lists." Here's an example of a nested list:

12
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
copy

Task

Construct a list called list_2 containing these elements:

[1, [2, 3], 4, [5, 6], 7]

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookNested List

Items within a Python list can also be lists, resulting in nested lists, sometimes referred to as "lists within lists." Here's an example of a nested list:

12
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
copy

Task

Construct a list called list_2 containing these elements:

[1, [2, 3], 4, [5, 6], 7]

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookNested List

Items within a Python list can also be lists, resulting in nested lists, sometimes referred to as "lists within lists." Here's an example of a nested list:

12
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
copy

Task

Construct a list called list_2 containing these elements:

[1, [2, 3], 4, [5, 6], 7]

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Items within a Python list can also be lists, resulting in nested lists, sometimes referred to as "lists within lists." Here's an example of a nested list:

12
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
copy

Task

Construct a list called list_2 containing these elements:

[1, [2, 3], 4, [5, 6], 7]

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt