what is extend py code example
Example 1: python extend
fruits = ['apple', 'banana', 'cherry']
cars = ['Ford', 'BMW', 'Volvo']
fruits.extend(cars)
print(fruits)
# ['apple', 'banana', 'cherry', 'Ford', 'BMW', 'Volvo']
Example 2: what is the use of extend in python
The extend() method adds the specified list elements (or any iterable) to the end of the current list.