Course Content
Python Data Structures
Python Data Structures
Nested 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:
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
Task
Construct a list called list_2
containing these elements:
[1, [2, 3], 4, [5, 6], 7]
Thanks for your feedback!
Nested 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:
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
Task
Construct a list called list_2
containing these elements:
[1, [2, 3], 4, [5, 6], 7]
Thanks for your feedback!
Nested 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:
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
Task
Construct a list called list_2
containing these elements:
[1, [2, 3], 4, [5, 6], 7]
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:
numbers = [1, [1, 2, 3], 2, [3, 4, 5, [7, 9]]] print(numbers)
Task
Construct a list called list_2
containing these elements:
[1, [2, 3], 4, [5, 6], 7]