add in array python code example
Example 1: append item to array python
data = []
data.append("Item")
print(data)
Example 2: python add element to array
my_list = []
my_list.append(12)
Example 3: how to create an array in python
array = ["1st", "2nd", "3rd"]
#prints: ['1st', '2nd', '3rd']
array.append("4th")
#prints: ['1st', '2nd', '3rd', '4th']
Example 4: arrays python
array = [1, 2, 3, 4]
array.append(5)
for i in array:
print(i)