how to add list code example
Example 1: how to add an item to a list in python
myList = [1, 2, 3]
myList.append(4)
Example 2: add list python
my_list = ['a', 'b', 'c']
my_list.append('e')
print(my_list)
# Output
#['a', 'b', 'c', 'e']
Example 3: how to add values to a list in python
myList = []
myList.append(value_to_add)
Example 4: add a list in python
list_of_names=["Bill", "John", "Susan", "Bob", "Emma","Katherine"]
new_name="James"
list_of_names.append(new_name)
# The list is now ["Bill", "John", "Susan", "Bob", "Emma","Katherine", "James"]