What Is a List in Python?

A list in Python is a beginner-friendly way to store multiple values in one variable. This page explains what a list is, what it is used for, and how to recognize one when you see it.

If you are just getting started, the main idea is simple: a list lets you keep related items together in order. For example, you might use a list for names, scores, or file paths.

Quick example

numbers = [1, 2, 3]
print(numbers)
print(type(numbers))

Output:

[1, 2, 3]
<class 'list'>

This example shows two important things:

  • A list uses square brackets []
  • Python recognizes it as a list type

What a list is

A list is a Python data type used to store multiple values in one variable.

Lists have a few easy-to-spot rules:

  • They use square brackets: []
  • Items are separated by commas
  • Items stay in order

Example:

colors = ["red", "green", "blue"]

Here, colors is a list with three items.

What lists are used for

Lists are useful when you need to work with a group of related values.

Common uses include:

  • Storing names, numbers, scores, or file paths
  • Looping through items one by one
  • Keeping data in a specific order
  • Changing the collection later by adding or removing items

For example, you could store student names in a list:

students = ["Maya", "Leo", "Sam"]

Then later, you could add another name or go through each student in a loop.

Main features of a Python list

Python lists have a few important features:

  • Lists are ordered
    The first item stays first, the second stays second, and so on.
  • Lists are mutable
    This means you can change them after creating them. You can add, remove, or update items. If you want to learn more about this idea, see mutability in Python.
  • A list can contain different data types
    A single list can store strings, numbers, booleans, or even other lists.
  • A list can contain duplicate values
    The same value can appear more than once.

Example:

mixed = ["apple", 10, True, "apple"]
print(mixed)

Simple example

Here is a small example that shows how to create a list, get one item, add a new item, and print the result.

names = ["Ana", "Ben", "Cara"]

print(names[0])

names.append("Diego")

print(names)

Output:

Ana
['Ana', 'Ben', 'Cara', 'Diego']

What this code does:

  • names = ["Ana", "Ben", "Cara"] creates a list
  • names[0] gets the first item
  • append("Diego") adds a new item to the end
  • print(names) shows the updated list

A useful detail for beginners: list indexes start at 0, not 1. So names[0] means the first item.

If you want a full guide, see Python lists explained for beginners. If you specifically want to add items, see how to add an item to a list in Python or the Python list append() method.

List vs other collection types

Lists are one of several ways to store groups of data in Python.

Use a list when:

  • Order matters
  • You may need to change the data later
  • You want to access items by position

Here is how lists compare to other common collection types:

  • List: ordered and changeable
  • Tuple: similar to a list, but not meant to be changed
  • Set: does not allow duplicates and does not keep items in a fixed order the same way
  • Dictionary: stores key-value pairs instead of positions

Examples:

my_list = ["a", "b", "c"]
my_tuple = ("a", "b", "c")
my_set = {"a", "b", "c"}
my_dict = {"name": "Ana", "age": 12}

If you want a beginner-friendly comparison, read when to use lists vs tuples vs sets vs dictionaries. You can also see what is a tuple in Python for a closer look at tuples.

What this page does not cover

This page is a glossary-style definition, not a full tutorial.

It does not cover:

  • Every list method
  • Step-by-step tasks for adding or removing items
  • Advanced list topics

For the next step, you can read:

Common mistakes

Beginners often run into the same list-related problems. Here are a few common ones.

  • Thinking a list can only store one type of value
    This is not true. A list can store mixed types.
  • Confusing lists with tuples or dictionaries
    Lists use square brackets []. Tuples use parentheses (). Dictionaries use curly braces {} with keys and values.
  • Forgetting that list indexes start at 0
    The first item is at index 0, not 1.
  • Using parentheses instead of square brackets
    This creates a tuple, not a list.

These quick checks can help when you are unsure what a variable contains:

print(my_list)
print(type(my_list))
print(len(my_list))
print(my_list[0])

What each line does:

  • print(my_list) shows the full value
  • print(type(my_list)) confirms whether it is a list
  • print(len(my_list)) shows how many items it contains
  • print(my_list[0]) shows the first item

Be careful with my_list[0] if the list might be empty. If you access an index that does not exist, you may get an error. For help with that, see IndexError: list index out of range.

FAQ

What is a list in Python in simple words?

A list is a container that holds multiple values in a single variable.

Can a Python list store different types of values?

Yes. A list can contain strings, numbers, booleans, and even other lists.

Are Python lists ordered?

Yes. Items stay in a specific order, and you can access them by index.

Can you change a list after creating it?

Yes. Lists are mutable, so you can add, remove, or update items.

What symbols are used to create a list?

Square brackets: []

See also