1#append to list
2lst = [1, 2, 3]
3something = 4
4lst.append(something)
5#lst is now [1, 2, 3, 4]
1my_list = []
2item1 = "test1"
3my_list.append(item1)
4
5print(my_list)
6# prints the list ["test1"]
1# Statically defined list
2my_list = [2, 5, 6]
3# Appending using slice assignment
4my_list[len(my_list):] = [5] # [2, 5, 6, 5]
5# Appending using append()
6my_list.append(9) # [2, 5, 6, 5, 9]
7# Appending using extend()
8my_list.extend([-4]) # [2, 5, 6, 5, 9, -4]
9# Appending using insert()
10my_list.insert(len(my_list), 3) # [2, 5, 6, 5, 9, -4, 3]