Python list Method - append()

https:‮w//‬ww.theitroad.com

The append() method in Python is a built-in method used to add an item to the end of a list.

Syntax:

list_name.append(item)

Example:

my_list = [1, 2, 3, 4]
my_list.append(5)
print(my_list)   # Output: [1, 2, 3, 4, 5]

The append() method modifies the original list and does not return anything. It is useful when we want to add a single item to the list. If we want to add multiple items to the list, we can use the extend() method or concatenate two lists using the + operator.