1
2List = ["One", "value"]
3
4List.append("to add") # "to add" can also be an int, a foat or whatever"
5
6#List is now ["One", "value","to add"]
7
8#Or
9
10List2 = ["One", "value"]
11# "to add" can be any type but IT MUST be in a list
12List2 += ["to add"] # can be seen as List2 = List2 + ["to add"]
13
14#List2 is now ["One", "value", "to add"]
1lst=[1,2,3,4]
2print(lst)
3
4#prints [1,2,3,4]
5
6lst.append(5)
7print(lst)
8
9#prints [1,2,3,4,5]
1 list = ['a', 'b', 'c', 'd']
2 print list[1:-1] ## ['b', 'c']
3 list[0:2] = 'z' ## replace ['a', 'b'] with ['z']
4 print list ## ['z', 'c', 'd']