Skip to content

Latest commit

 

History

History
16 lines (9 loc) · 663 Bytes

013-Tuples.md

File metadata and controls

16 lines (9 loc) · 663 Bytes

Tuples

What are tuples in Python?

Tuples are sequences just like lists, except they are immutable. Immutable objects cannot be changed or updated in the same way a list can. They are less flexible, however this means they are easier to manage and control. Sorting or extracting parts of a list can bring back unexpected results, and so sometimes the use of tuples can be an advantage.

How to display tuples

A tuple is displayed within brackets () and separated by commas. A tuple can contain a mixture of strings and numbers. Here is an example of a tuple:

my_tuple = ('birthday', 'christmas', 'new year', 1988, 2010, 2018)