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']