List (Python)

A Python list is an ordered, changeable collection of items written in square brackets. It is Python's version of an array and can hold mixed types.

Python

Syntax

my_list = [item1, item2, item3]

Examples

Python

fruits = ["apple", "banana", "cherry"]
fruits.append("date")
print(fruits[0], len(fruits))

Output:

apple 4

Learn it in a lesson

See also

Back to the Dictionary