Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating a List
course content

Conteúdo do Curso

Python Data Structures

Creating a ListCreating a List

Data structures organize data based on its type. In Python, the primary data structures are lists, tuples, dictionaries, and sets, each with its distinct characteristics. In this course, we'll delve into these structures and discover how to utilize them effectively.

Python lists are ordered collections that can be changed and can hold items of any type. To make a list in Python, enclose the items within square brackets. Check out this example:

As demonstrated, a list can hold any combination of items, or even none at all. Consider the following example:

To initialize an empty list, simply assign empty square brackets to a variable.

A list can house items of any data type, be it a string or a number. Here's another example:

Time to practice.


Craft your own list named list_1 with the following values:

1, 10, 'California', True

After crafting the list, hit the button underneath the code to verify your solution.

Tudo estava claro?

Seção 1. Capítulo 1
toggle bottom row