About this question
This question looks at how to combine or extend immutable data structures like tuples by creating a new tuple that includes the original elements plus the one you want to add.
This question looks at how to combine or extend immutable data structures like tuples by creating a new tuple that includes the original elements plus the one you want to add.
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Python Expert
Answered on Jun 16, 2025
In Python, tuples are immutable, which means you can’t modify them in place — including adding elements directly. But that doesn’t mean you’re stuck! You can still create a new tuple by combining the existing one with the new tuple you want to add.
Here’s how you do it:
Let’s say you have a tuple of tuples like this:
original = ((1, 2), (3, 4))And now you want to add another tuple (5, 6) to it. Just do this:
new_tuple = original + ((5, 6),) Why double parentheses?
The extra parentheses around (5, 6), are needed to define it as a single-element tuple. Without that comma, Python just treats it as a grouped expression.
Key points to remember:
Example in action:
original = (("apple", "banana"), ("orange", "grape"))
new_item = ("kiwi", "melon")
result = original + (new_item,)
print(result)
# Output: (('apple', 'banana'), ('orange', 'grape'), ('kiwi', 'melon'))So while you’re not technically “adding” in the traditional sense, this approach gives you the same result — a new tuple that includes all the elements you need!
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Most-read guides across JanBask
Common Python interview questions, answered
Guides, tips and career advice on Python from JanBask experts.
Python How to Become a Python Developer: A Step-by-Step Guide for Beginners
Discover how to become a Python Developer via a practical 7-step guide build projects, maintain clean code, practice daily, and…
Python PCEP Certification Guide: Entry-Level Python Programmer Certification
Explore this PCEP certification guide for insights on cost, exam format, passing score, application, training, and study tips.…
Python Top 50+ Python Projects ideas for Beginners to Advanced
Discover innovative Python project ideas, explore advanced Python projects, and find good Python projects for beginners and…
Python How To Comment Out Multiple Lines In Python Like A Pro
Commenting out code is a common practice among programmers. It allows you to temporarily disable parts of your code without…