Search⌘ K
AI Features

Basic Tuple Operations

Explore basic operations on Python tuples including their immutability, concatenation, cloning, aliasing, searching, and comparison. Understand how tuples handle mutable and immutable objects to enhance your programming skills.

We'll cover the following...

Some basic tuple operations are given below.

Mutability

Unlike a list, a tuple is immutable, i.e., it cannot be modified.

Python 3.8
msg = ('Fall', 'In', 'Line')
msg[0] ='FALL' # error
msg[1:3] = ('Above', 'Mark') # error

Note: Since a tuple is immutable, operations like append(), remove(), and insert() do not work with a tuple.

Though a tuple itself is immutable, it can contain mutable objects like lists.

 ...