Skip to content

Home

What is the difference between lists and tuples in Python?

Python's lists and tuples may seem pretty similar in syntax and function, however they have some major differences the most important of which is the fact that lists are mutable and tuples aren't. Here's a quick breakdown:

Lists

Tuples

When to use each one

Lists provide a more accessible API and should be used whenever similar types of objects need to be stored and are expected to change over the course of the application's execution. On the other hand, tuples should be used for immutable data, behaving more like constants than variables.

More like this

Start typing a keyphrase to see matching snippets.