Computer >> Computer tutorials >  >> Programming >> Python

How can I append a tuple into another tuple in Python?


You can directly add a tuple to another tuple using a + operator. For example,

Example

x = (1, 2, 3)
y = (4, 5)
x = x + y
print(x)

Output

This will give the output

x = (1, 2, 3)
y = (4, 5)
x = x + y