Home >>Python List Methods >Python List extend() Method
Python list extend() method is used to add the specified list elements or any iterable to the end of the current list.
Syntax:list.extend(iterable)
Parameter | Description |
---|---|
iterable | This is a required parameter. It defines any iterable. |
x = ['Abhi', 'Alpha', 'Harry']
y = ['Venom', 'Jerry', 'Rocket']
x.extend(y)
print(x)
x = ['Abhi', 'Alpha', 'Harry']
y = ['Venom', 'Jerry', 'Rocket']
z = (1, 2, 3, 4)
x.extend(y)
x.extend(z)
print(x)