.append()

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

Syntax

Loading...

The .append() will place the object passed in as a new element at the very end of the list. Printing the list afterwards will visually show the appended value.

This method is not to be confused with returning an entirely new list with the passed object.

Example

To add 'πŸ₯š' to the end of the grocery list:

Loading...

Codebyte Example

To add 'tulips' to the end of the orders list:

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn Python on Codecademy