No description has been provided for this image

Open In Colab

TUPLES¶

Tuples are inmutable structures in Python, they look like lists but do not share much of their functionality:

In [ ]:
weekend="Friday", "Saturday", "Sunday"
In [ ]:
type(weekend)

You can access:

In [ ]:
weekend[0]

But no other operation is allowed:

In [ ]:
del weekend[0]
In [ ]:
weekend[0]='Viernes'
In [ ]:
weekend[3]='Extra Holiday'

You can concatenate two tuples into a new one:

In [ ]:
otherDays='Monday','Tuesday', 'Wednesday', 'Thursday'
otherDays
In [ ]:
allDays=weekend + otherDays
allDays

But it has not altered any previous tuple.