python extande array code example
Example 1: extend a list python
#adding two or more elements in a list
list1 = [1,2,3,4,5]
list1.extend([6,7,8])
print(list1)
#output = [1, 2, 3 ,4 ,5, 6, 7, 8]
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.