adding to list code example

Example 1: add something to list python

#append to list
lst = [1, 2, 3]
something = 4
lst.append(something)
#lst is now [1, 2, 3, 4]

Example 2: python how to add to a list

food = "banana"
basket = []

basket.append(food)

Example 3: how do i add to a list in python

a=[1,2,3,4]

a+=[5,6]

Example 4: how to add an item to a list python

numbers = [1, 2, 3, 4]
numbers.append(10)
print(numbers)

Example 5: 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"]