add new value to list python code example

Example 1: add item to list python

list.append(item)

Example 2: how to add a value to a list in python

myList = [apples, grapes]
fruit = input()#this takes user input on what they want to add to the list
myList.append(fruit)
#myList is now [apples, grapes, and whatever the user put for their input]

Example 3: append to lists python

list = []          ## Start as the empty list
  list.append('a')   ## Use append() to add elements
  list.append('b')

Example 4: using append in python

lst=[1,2,3,4]
print(lst)

#prints [1,2,3,4]

lst.append(5)
print(lst)

#prints [1,2,3,4,5]