MemotivaBuilt-in data types

When would you use a tuple over a list?

Built-in data types

Audio flashcard · 0:14

Nortren·

When would you use a tuple over a list?

0:14

Use a tuple when the collection has a fixed structure and should not change. Tuples express intent that the data is constant. They are appropriate for representing records, returning multiple values from a function, and as dictionary keys. Lists are for collections that grow or change.
docs.python.org