Python menambahkan elemen ke array
my_list = []
my_list.append(12)
Gentle Gazelle
my_list = []
my_list.append(12)
theArray = []
theArray.append(0)
print(theArray) # [0]
theArray.append(1)
print(theArray) # [0, 1]
theArray.append(4)
print(theArray) # [0, 1, 4]
capitals = ['A', 'B', 'C']
lowers = ['a', 'b', 'c']
alphabets = capitals + lowers
a = [1, 2, 3]
b = [10, 20]
a = a + b # Create a new list a+b and assign back to a.
print a
# [1, 2, 3, 10, 20]
# Equivalently:
a = [1, 2, 3]
b = [10, 20]
a += b
print a
# [1, 2, 3, 10, 20]