What does the list method append() do? code example

Example 1: python list append

# Python list mutation, adding elements
history = ["when"]

# adds item to the end of a list
history.append("how")
# ["when", "how"]

# combine lists
history.extend( ["what", "why"] ) # works with tuples too
# or
history = history + ["what", "why"]
# ["when", "how", "what", "why"]

# insert at target position
history.insert(3, "where")
# ["when", "how, "what", "where", "why"]
#

Example 2: append list python

my_list = ['a', 'b', 'c']
my_list.append('e')
print(my_list)
# Output
#['a', 'b', 'c', 'e']