DEV Community

Tania
Tania

Posted on • Originally published at kodlogs.com

How to append to the beginning of a list python

Append ( ) in python
Anyone who is learning programming will have seen the append function in most of the programs. Most of the students will not know about it and will know more about this function. Append means that we have an element in our list. The function of the append list is the value that we want to add at the end of the list, so we will use the append function. You must keep in mind that the append function should only be added at the end. Will never do in the beginning. This means that we can make the list bigger and longer than the end.

There are other similar functions like insert, and extends and add functions, their function is also similar to append function. Yes, there is only a slight difference. Extend lets the element of one list be added to the element of another list. Sometimes there are multiple elements. And if they have to be added to the list, then I will use the extend method. Does this by adding one to the end element and having it reprinted. Most use the append function. When we start programming a list, it is used everywhere.

The syntax for using it is something like:

list.append (item).

Top comments (0)