Sometimes, while working with records, we might have a common problem of adding contents of one tuple with corresponding index of other tuple. This has application in almost all the domains in which we work with tuple records. Let’s discuss certain ways in which this task can be performed.

**Method #1 : Using map() + lambda**

Combination of above functionalities can solve the problem for us. In this, we compute the summation using lambda functions and extend the logic to keys using

`map()`

.
`# Python3 code to demonstrate working of ` `# Addition of tuples ` `# using map() + lambda ` ` ` `# initialize tuples ` `test_tup1 ` `=` `(` `10` `, ` `4` `, ` `5` `) ` `test_tup2 ` `=` `(` `2` `, ` `5` `, ` `18` `) ` ` ` `# printing original tuples ` `print` `(` `"The original tuple 1 : "` `+` `str` `(test_tup1)) ` `print` `(` `"The original tuple 2 : "` `+` `str` `(test_tup2)) ` ` ` `# Addition of tuples ` `# using map() + lambda ` `res ` `=` `tuple` `(` `map` `(` `lambda` `i, j: i ` `+` `j, test_tup1, test_tup2)) ` ` ` `# printing result ` `print` `(` `"Resultant tuple after addition : "` `+` `str` `(res)) ` |

*chevron_right*

*filter_none*

**Output :**

The original tuple 1 : (10, 4, 5) The original tuple 2 : (2, 5, 18) Resultant tuple after addition : (12, 9, 23)

**Method #2 : Using map() + zip() + sum()**

The combination of above functions can also be used to achieve this particular task. In this, we add inbuilt

`sum()`

to perform summation and zip the like indices using `zip()`

and extend logic to both tuples using `map()`

.
`# Python3 code to demonstrate working of ` `# Addition of tuples ` `# using map() + zip() + sum() ` ` ` `# initialize tuples ` `test_tup1 ` `=` `(` `10` `, ` `4` `, ` `5` `) ` `test_tup2 ` `=` `(` `2` `, ` `5` `, ` `18` `) ` ` ` `# printing original tuples ` `print` `(` `"The original tuple 1 : "` `+` `str` `(test_tup1)) ` `print` `(` `"The original tuple 2 : "` `+` `str` `(test_tup2)) ` ` ` `# Addition of tuples ` `# using map() + zip() + sum() ` `res ` `=` `tuple` `(` `map` `(` `sum` `, ` `zip` `(test_tup1, test_tup2))) ` ` ` `# printing result ` `print` `(` `"Resultant tuple after addition : "` `+` `str` `(res)) ` |

*chevron_right*

*filter_none*

**Output :**

The original tuple 1 : (10, 4, 5) The original tuple 2 : (2, 5, 18) Resultant tuple after addition : (12, 9, 23)

## Recommended Posts:

- Addition in Nested Tuples - Python
- Python - Pairwise Addition in Tuples
- Python | Remove duplicate tuples from list of tuples
- Python | Find the tuples containing the given element from a list of tuples
- Python | Remove tuples from list of tuples if greater than n
- Python | Remove tuples having duplicate first value from given list of tuples
- Python | Count tuples occurrence in list of tuples
- Python | Combining tuples in list of tuples
- Python | Convert string tuples to list tuples
- Python | How to Concatenate tuples to nested tuples
- Python - Filter all uppercase characters Tuples from given list of tuples
- Python program to find Tuples with positive elements in List of tuples
- Python program to find tuples which have all elements divisible by K from a list of tuples
- Addition and Blending of images using OpenCV in Python
- Python | Rear Addition of Record
- Python program for addition and subtraction of complex numbers
- Python - Specific Range Addition in List
- Python - Diagonal element addition among lists
- Python | Alternate character addition
- Python - Row-wise element Addition in Tuple Matrix

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.