The difference between Python's list methods append and extend are as follows which can be understood by the below-mentioned codes:-
append():
The append function is used to append the objects at the end of the list. Below is the piece of code that explains how it works:-
x = [1, 2, 3]
x.append([4, 5])
print (x)
extend():
The extend function is used to extend the list by appending elements from the iterable. You can visualize this by looking at the example mentioned below:-
x = [1, 2, 3]
x.extend([4, 5])
print (x)
You can use the following video tutorials to clear all your doubts:-
Learn in detail about Python by enrolling in Intellipaat Python Course online and upskill.