VOOZH about

URL: https://www.geeksforgeeks.org/python/python-adding-tuple-to-list-and-vice-versa/

⇱ Python - Adding Tuple to List and Vice - Versa - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python - Adding Tuple to List and Vice - Versa

Last Updated : 25 Oct, 2025

Given a list and a tuple (or vice versa) and the task is to combine them. This could mean appending the tuple as a single element to the list, merging elements individually, or combining a list with a tuple after converting it.

For Example:

a = [1, 2, 3]
b = (4, 5)
c = [6, 7]

Adding b to a can produce [1, 2, 3, (4, 5)] or [1, 2, 3, 4, 5].
Adding c to b can produce (4, 5, 6, 7).

Let’s explore different methods to achieve this.

Using extend() and + operator

This method merges sequences efficiently. extend() adds each element individually to a list, while + concatenates sequences.


Output
[1, 2, 3, 4, 5]
(4, 5, 6, 7)

Explanation: extend(b) adds each element of b to a and tuple(c) converts list c to a tuple, then + concatenates b and c into d.

Using * Operator and append()

append() adds the entire tuple as a single element. The * operator unpacks elements for merging sequences.


Output
[1, 2, 3, (4, 5)]
(4, 5, 6, 7)

Explanation: append(b) nests b inside and (*b, *c) unpacks both sequences into a new tuple.

Using insert() and List Comprehension

insert() places the tuple at a specific position. List comprehension helps create a new tuple when merging.


Output
[1, 2, 3, (4, 5)]
(4, 5, 6, 7)

Explanation: insert(len(a), b) adds b at the end of a and tuple(x for x in b) creates a tuple from b, then + tuple(c) merges it with c.

Using list() and tuple()

Convert tuples to lists for modifications, then convert back when needed.


Output
[1, 2, 3, 4, 5]
(4, 5, 6, 7)

Explanation: list(b) converts tuple to list to extend a and temp_list.extend(c) merges c, then tuple(temp_list) converts it back to a tuple.

Comment