how to extend a new list from another list in pyhton 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: add all items in list to another list python
a = [1]
b = [2,3]
a.extend(b)
print(a)
------ OR -------
a += b