APPEND()

The append() method is used to add a new item to the end of a list. This operation increases the size of the list by one and places the new element at the last position. Because Python lists are dynamic, no manual memory management is required—append() automatically handles the resizing as needed.

numbers = [1, 2, 3, 4, 5]
userInput = int(input())
numbers.append(userInput)

Last updated