W3docs

What is the difference between Python's list methods append and extend?

The append method adds an item to the end of a list.

The append method adds an item to the end of a list. The item can be of any type (integer, string, etc.).

The extend method adds all the items in an iterable (such as a list) to the end of the list.

Here's an example:

Add items to a list using the append method and extending the list with another list using the extend method in Python

python— editable, runs on the server

The main difference between the two is that append adds a single item to the list, while extend adds all the items in an iterable to the list.