The append() function takes a single element as an argument and appends it to the list. The argument can be any datatype, even a list. The argument will be added as a single element.
>>>list1 = [10, 20, 30]
>>>list1.append(40)
list1 will now be [10, 20, 30, 40]
>>>list1 = [10, 20, 30]
>>>list1.append([40, 50])
Here [40, 50] is a list which will be considered as a single argument, and will be added to the list at index 3. 'list1' will now be [10, 20, 30, [40, 50]]
The extend() function takes any iterable data type (e.g. list, tuple, string, dictionary) as an argument and adds all the elements of the list passed as an argument to the end of the given list. This function can be used to add more than one element in the list in a single statement.
>>> list1 = [2, 4, 5, 6]
>>> list1.extend((2, 3, 4, 5))
>>> print(list1)
OUTPUT:
[2, 4, 5, 6, 2, 3, 4, 5]