Answers for "extend use in pythonn"

3

python extend

fruits = ['apple', 'banana', 'cherry']
cars = ['Ford', 'BMW', 'Volvo']

fruits.extend(cars)

print(fruits)
# ['apple', 'banana', 'cherry', 'Ford', 'BMW', 'Volvo']
Posted by: Guest on April-15-2021
-1

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.
Posted by: Guest on November-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language