Python: use the list append function - how it works
How to use the list append function in Python is explained in our Python guide, which is easy to understand. Because programming with Python is not that difficult.
Python: use the list append function - how it works
The list append function in Python is very useful when you want to add data to an existing list.
- The first thing to do is to create a list. This can be done with the command "List = ['Salad', 'Celery', 'Schnitzel']" (without quotes).
- Now you can use the "List.append (42)" command to insert the number 42 at the end of the list, for example. You can also insert strings with a command such as "List.append ('String')".
- As always, you can have your list printed with a print command.
More tips about Python in our CHIP guides
Tip: You can find further programming tutorials on our Python programming language topic page. For example, we will show you how to use the random command to generate numbers at random.