Table of Contents Hide
The append() method in Python adds an element to the end of the list. After appending the new element, the size of the list increases by one.
In this tutorial, we will learn about the Python list append() method with the help of examples.
Syntax of List append()
The syntax of the
append() method is:
append() method takes a single parameter.
- item – an item to be added at the end of the list. The element can be of any data type such as number, decimal, string, character, list etc.
Return Value from List append()
append() method doesn’t return any value.
Note: A list is an object. If you append another list onto a list, the element list that gets added will be a single object at the end of the list.
Example 1: Adding Element to a List
Example 2: Adding List into the List
Since we are appending a list into an existing list it would be added as a single element into the list as shown in below output.