Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Working With Lists | Lists, Loops And Functions
Python: For Beginners

Working With Lists

Deslize para mostrar o menu

In this chapter, we will learn about lists — one of the most useful data structures in Python.

A list is a collection of items. For example, you can store a list of colours or numbers.

Lists are defined using square brackets. You can also sort them using the sorted() function, or apply a lambda to transform elements — lambda x: x * 2 — which is an anonymous function. We'll cover lambdas properly in the next section.

Here is how to create a list:

123
fruits = ['apple', 'banana', 'cherry'] print(fruits[0]) print('The list has', len(fruits), 'items')

Decorators are a powerful way to modify function behaviour at definition time.

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 2. Capítulo 1
some-alt