Articles

Program to concatenate two lists in Python | extend function in python list

Program to concatenate two lists in Python | extend function in python list


In this python programming guide, we are going to learn

  • program to concatenate two lists in python using extend in python list

Program to concatenate two lists in Python

The program uses extend in python to concatenate two lists in python is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

fruits = ["banana","apple","guava","mango"]

new_fruits = ["cherry","grapes","watermelon"]

fruits.extend(new_fruits)

print(fruits)
        

The output of the extend in python list program is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
['banana', 'apple', 'guava', 'mango', 'cherry', 'grapes', 'watermelon']

Few important tips about the program

1. In python, we have extend() method which is used to join two lists.

2. It joins the list passed to it as an argument to the invoking list.

 

extend function in list in python program

concatenate lists in python using extend function in list in python

This program uses extend function in python list or extend function in list in python.


Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :    Published Date : Jun 28,2022  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!