Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python | Convert list of tuples into list
Next article icon

Merge Two Lists into List of Tuples – Python

Last Updated : 13 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The task of merging two lists into a list of tuples involves combining corresponding elements from both lists into paired tuples. For example, given two lists like a = [1, 2, 3] and b = [‘a’, ‘b’, ‘c’], the goal is to merge them into a list of tuples, resulting in [(1, ‘a’), (2, ‘b’), (3, ‘c’)].

Using zip()

zip() is the most efficient and recommended approach for merging two lists into tuples. It pairs elements from multiple iterables based on their position and returns an iterator that generates tuples.

Python
# Define two lists to be merged a = [1, 2, 3]  b = ['a', 'b', 'c']  res = list(zip(a, b)) print(res) 

Output
[(1, 'a'), (2, 'b'), (3, 'c')] 

Explanation: zip() pairs elements from both lists into tuples and list() converts the result into [(1, ‘a’), (2, ‘b’), (3, ‘c’)] .

Table of Content

  • Using list comprehension
  • Using map()
  • Using for loop

Using list comprehension

This method is a variation of zip() combined with a list comprehension. While it provides flexibility if further transformation is needed within the comprehension, it is often considered redundant when simply merging lists.

Python
# Define two lists to be merged a = [1, 2, 3] b = ['a', 'b', 'c']  res = [(x, y) for x, y in zip(a, b)] print(res) 

Output
[(1, 'a'), (2, 'b'), (3, 'c')] 

Explanation: zip() pairs elements from both lists and the list comprehension creates a list of tuples .

Using map()

map() applies a function to elements from multiple iterables. Combined with lambda, it can merge two lists into tuples. This is a functional programming approach but is less readable compared to zip().

Python
# Define two lists to be merged a = [1, 2, 3] b = ['a', 'b', 'c']  res = list(map(lambda x, y: (x, y), a, b)) print(res) 

Output
[(1, 'a'), (2, 'b'), (3, 'c')] 

Explanation: map() with lambda pairs elements from both lists into tuples and list() converts the result into [(1, ‘a’), (2, ‘b’), (3, ‘c’)] .

Using for loop

This is the most basic and least efficient approach. It involves manually iterating over the indices of the lists and appending tuples to a result list. While flexible, it is slower compared to the other methods.

Python
# Define two lists to be merged a = [1, 2, 3] b = ['a', 'b', 'c']  res = [] # initialize empty list  for i in range(len(a)):     res.append((a[i], b[i])) print(res) 

Output
[(1, 'a'), (2, 'b'), (3, 'c')] 

Explanation: for loop iterates over indices using range(len(a)), combining a[i] and b[i] into tuples and appending them to res.



Next Article
Python | Convert list of tuples into list

S

Smitha Dinesh Semwal
Improve
Article Tags :
  • Python
  • Python Programs
  • Python list-programs
  • Python tuple-programs
Practice Tags :
  • python

Similar Reads

  • Python | Split nested list into two lists
    Given a nested 2D list, the task is to split the nested list into two lists such that the first list contains the first elements of each sublist and the second list contains the second element of each sublist. In this article, we will see how to split nested lists into two lists in Python. Python Sp
    5 min read
  • Python | Convert list of tuples into list
    In Python we often need to convert a list of tuples into a flat list, especially when we work with datasets or nested structures. In this article, we will explore various methods to Convert a list of tuples into a list. Using itertools.chain() itertools.chain() is the most efficient way to flatten a
    3 min read
  • Python - Convert a list into tuple of lists
    When working with data structures in Python, there are times when we need to convert a list into a tuple of smaller lists. For example, given a list [1, 2, 3, 4, 5, 6], we may want to split it into a tuple of two lists like ([1, 2, 3], [4, 5, 6]). We will explore different methods to achieve this co
    3 min read
  • Python - List of tuples to multiple lists
    Converting a list of tuples into multiple lists involves separating the tuple elements into individual lists. This can be achieved using methods like zip(), list comprehensions or loops, each offering a simple and efficient way to extract and organize the data. Using zip()zip() function is a concise
    3 min read
  • Merge Multiple Lists into one List
    In this article, we are going to learn how to merge multiple lists into one list. extend() method is another simple way to merge lists in Python. It modifies the original list by appending the elements of another list to it. This method does not create a new list but instead adds elements to an exis
    3 min read
  • Python | Merge two list of lists according to first element
    Given two list of lists of equal length, write a Python program to merge the given two lists, according to the first common element of each sublist. Examples: Input : lst1 = [[1, 'Alice'], [2, 'Bob'], [3, 'Cara']] lst2 = [[1, 'Delhi'], [2, 'Mumbai'], [3, 'Chennai']] Output : [[1, 'Alice', 'Delhi'],
    6 min read
  • Convert List of Tuples To Multiple Lists in Python
    When working with data in Python, it's common to encounter situations where we need to convert a list of tuples into separate lists. For example, if we have a list of tuples where each tuple represents a pair of related data points, we may want to split this into individual lists for easier processi
    4 min read
  • How to Zip two lists of lists in Python?
    zip() function typically aggregates values from containers. However, there are cases where we need to merge multiple lists of lists. In this article, we will explore various efficient approaches to Zip two lists of lists in Python. List Comprehension provides a concise way to zip two lists of lists
    3 min read
  • Python - Merging duplicates to list of list
    We are given a list we need to merge the duplicate to lists of list. For example a list a=[1,2,2,3,4,4,4,5] we need to merge all the duplicates in lists so that the output should be [[2,2],[4,4,4]]. This can be done by using multiple functions like defaultdict from collections and Counter and variou
    3 min read
  • Python - Convert List of Lists to Tuple of Tuples
    Sometimes, while working with Python data, we can have a problem in which we need to perform interconversion of data types. This kind of problem can occur in domains in which we need to get data in particular formats such as Machine Learning. Let us discuss certain ways in which this task can be per
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences