Skip to content

Python extend tuple | Example code

  • by

There’s no append() or extend() method for tuples in Python. Tuples are immutable data types so you can’t remove the element from it. However, you can extend the tuple using concatenate or slice method.

Python extend tuple example

Simple example code to will not extend tuples but form new tuples:

Concatenate tuples

tup1 = (1, 2, 3)
tup2 = tup1 + (4, 5, 6)



Python extend tuple

Using slice notation

Remove an element from a tuple

tup1 = (1, 2, 3)

res = tup1[1:]


Output: (2, 3)

Build tuple from existing values:

name = "John"
age = 30
location = "New York"

p1 = (name, age, location)


Output: (‘John’, 30, ‘New York’)

Do comment if you have any doubts or suggestions on this Python tuple program.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *