What is append in python?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Green-and-Purple-Dynamic-Frames-Action-_-Adventure-YouTube-Channel-Art-11-1024x576.jpg)
In python append() function is used to add the element in the list. It just adds the element to end and increase the size of the list by 1.
syntax:-
list.append(item_name)
e.g.,
l=[1, 2, 3, 4, 5] l.append(6) print(l)
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-770-1024x407.png)
We can add a list to a list with the help of append() function.
e.g.,
a=[1, 3, 5, 7, 9] b=[2, 4, 6, 8] a.append(b) print(a)
![](https://pythonpoint.net/wp-content/uploads/2020/11/Screenshot-772-1024x361.png)
This is how we can use append in python.
Subscribe
Login
Please login to comment
0 Discussion