List extend() Syntax

list_name.extend(iterable)

Parameters:

  • iterable: Any iterable (list, set, tuple, etc.)

Returns

Python List extend() returns none.

Python List extend() Method

The Python List extend() method adds items of an iterable (list, tuple, dictionary, etc) at the end of a list.

Example

Python3




cars = ["Audi","BMW","Jaguar"]
other_cars = ["Maruti", "Tata"]
cars.extend(other_cars)
print(cars)


Output

['Audi', 'BMW', 'Jaguar', 'Maruti', 'Tata']

Similar Reads

List extend() Syntax

...

What is Python List extend() method?

list_name.extend(iterable)...

How to use list extend() method in Python

List extend() function is an in-built function of Python that extends a list by adding values of an iterable (list, tuple, string, etc) at the end of that list....

More Examples on List extend()

You can easily extend a list using extend() function. let’s see how to extend a list in Python with an example for better understanding....

Python list Extend with + Operator

...

Python list extend() vs append()

Let’s see some of the different scenarios where we use list extend() method....