Python List append() method
The Python list append() method adds an item to the end of the list. The length of the list increase by one.
Syntax of append()
The syntax for the same is :-
list_name.append(item)
Parameters of append()
The method takes only a single argument
item - an item to be added at the end of the list
The item can be any object like number, string, dictionary, list, set, boolean, etc.
Return value of append()
The append() method doesn’t return anything and just changes the list inplace. Hence, it returns None.
Example of appending an element to a list
color_list = ['red', 'yellow', 'blue']
color_list.append('green')
print(color_list)
['red', 'yellow', 'blue', 'green']
Example of appending a list to a list
color_list.append(['black', 'white'])
print(color_list)
['red', 'yellow', 'blue', 'green', ['black', 'white']]