Python List Append is one of the most used Python List Methods. With this Python List Append method, we can add a new member to the end of the lists. Let’s give some example to learn this python function better.
Below, we will use append() method to add new string members at the end of the string.
The output of this Python List Append code will be like below:
You can learn also How to Sort Python Lists
You can also watch this lesson on Youtube!
We can do the same thing that we do above, with plus (+) operator like blow. Here, we will use two different string lists and we will combine these string lists in one string.
The output of this python code will be like below:
We can use Python List Append code for number lists also. Below, we will add 100 to the end of number list.
The output of this python command will be like below:
If we use Python List Append code with two lists, the second list is added to the previous list like below:
If you would like to extend the list, then you should use another function of python. Python list extend function an do this job. Let’s give an example for Python list extend command. Here, we will use extend () function with the new added list as parameter.
The output of this python code will be like below:
As you can see above, the new list has created as we use plus (+) sign.
In this lesson, we have learned how to use Python List Append code. We have done different examples on append function of python. You can increase your experience on this python method with more examples. You can also use this method with your different python codes.
Leave a Reply