Definition
The extend() method adds the specified list elements (or any iterable) to the end of the current list.
Syntax
list.extend(iter)
Parameters
Parameter | Description |
---|---|
iter | Required. Any iterable (list, set, tuple, etc.) |
Examples:
cars = ['Nissan', 'Ford', 'Volkswagen']
cars2 = ['Volvo', 'Kia', 'GMC']
cars.extend(cars2)
print(cars)