In this program, we will take two lists as inputs and combine them to make a single list using extend method with the help of the below-given steps.
Add lists using extend method:
Steps to solve the program
- Take two lists as input.
- Add them using extend().
- Print the output.
#Input lists
list1 = [2,4,6,8,1]
list2 = [23,56,11,89]
#Combining lists
list1.extend(list2)
#Printing output
print(list1)
Output :
[2, 4, 6, 8, 1, 23, 56, 11, 89]
Related Articles
Python program to sort list data, with the sort and sorted method.
Python program to remove data from the list from a specific index using the pop method.
Python program to get the max, min, and sum of the list using in-built functions.
Python program to check whether a list contains a sublist.
Python program to generate all sublists with 5 or more elements in it from the given list.
Python program to find the second largest number from the list.