The `append()` function in Python is used to add an element to the end of a list. It modifies the original list by adding the new element.
Syntax:
list.append(element)
list: The list you want to add an element to.
element: The element you want to add to the list.
Example:
# Create a list my_list = [1, 2, 3] # Append an element to the list my_list.append(4) # Print the updated list print(my_list)
Output:
[1, 2, 3, 4]
In this example, the element `4` is added to the end of the list `my_list`, updating it to `[1, 2, 3, 4]`.