Nested Lists in Python #
Because lists in Python can contain any other types of data, they can also contain other lists.
For example, here's a list that contains 3 lists, and each of those lists also contains 3 number elements.
my_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Exercise #
- Create a list
my_nested_listwith 3 elements - All 3 elements must be lists
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules