adding element in list python code example
Example 1: how to add an item to a list in python
myList = [1, 2, 3]
myList.append(4)
Example 2: python how to add to a list
food = "banana"
basket = []
basket.append(food)
Example 3: append to lists python
list = [1, 2, 3]
print list.append(4) ## NO, does not work, append() returns None
## Correct pattern:
list.append(4)
print list ## [1, 2, 3, 4]