Python Tutorials · Python Lists
Add List Items
Learn all about Add List Items in this comprehensive tutorial.
5 min read beginner
- •To add an item to the end of the list, use the append() method:
- •To insert a list item at a specified index, use the insert() method.
- •To append elements from another list to the current list, use the extend() method.
- •The extend() method does not have to append lists, you can add any iterable object (tuples, sets, dictionaries etc.
Append Items
To add an item to the end of the list, use the append() method:
python
Insert Items
To insert a list item at a specified index, use the insert() method.
The insert() method inserts an item at the specified index:
python
Note: Note: As a result of the examples above, the lists will now contain 4 items.
Extend List
To append elements from another list to the current list, use the extend() method.
python
The elements will be added to the end of the list.
Add Any Iterable
The extend() method does not have to append lists, you can add any iterable object (tuples, sets, dictionaries etc.).
python
Module quiz
Test your knowledge on this module
2 questions