Python Add Multiple Elements to a List Example
Published On: 07/12/2022 | Category:
Python

Hi Guys,
This post will give you example of how to add multiple elements to a list in python. step by step explain python add multiple elements to a list example.This article will give you simple example of how to insert multiple elements in list in python. if you have question about python list add multiple elements then I will give simple example with solution.
In Python, there are many ways to add multiple items to a python list. i will give you three examples using extend() method, append() method and concat to insert multiple elements to python list. so let's see the below examples.
So let's see bellow example:
Example 1:
main.pymyList = [1, 2, 3, 4] # Add new multiple elements to list myList.extend([5, 6, 7]) print(myList)Output
[1, 2, 3, 4, 5, 6, 7]
Example 2:
main.pymyList = [1, 2, 3, 4] # Add new multiple elements to list myList.append(5) myList.append(6) myList.append(7) print(myList)Output
[1, 2, 3, 4, 5, 6, 7]
Example 3:
main.pymyList = [1, 2, 3, 4] myList2 = [5, 6, 7] # Add new multiple elements to list newList = myList + myList2 print(newList)Output
[1, 2, 3, 4, 5, 6, 7]
It will help you....
Happy Pythonic Coding!