Array in Python programming is a collection of the same type of data items, which is accessed by using common name. we use two types of arrays in Python programming one-dimensional array and two-dimensional array.
arr = [1, 4, 22, 43, 4, 5] #'arr' is name of Array and assigning Elements to it.
print(arr) #and printing, it printing '[1, 4, 22, 43, 4, 5]'.
arr = [1, 4, 22, 43, 4, 5] #'arr' is name of Array and assigning Elements to it.
for num in arr: #loop looping on 'arr' array Elements, and saving in 'num'.
print(num) #and printing.
arr = [1, 2, 3] + [4, 5, 6] #'arr' is name of array and assigning Elements to it.
for num in arr: #loop looping on 'arr' Array Elements and saving in 'num'.
print(num) #it printing '1 2 3 4 5 6'.
arr = [1, 2, 3, 4] #assigning Elements to 'arr' array.
arr2 = [5, 6, 7, 8] #assigning Elements to 'arr2' array.
arr.extend(arr2) #Extending Arrays.
for num in arr:
print(num)
arr = [1, 2, 3]
arr.append(4) #appending 4 to 'arr' array Elements.
for val in arr:
print(val) #it printing '1, 2, 3, 4'.