Python program to print the elements of an array

bookmark

#Initialize array     
arr = [1, 2, 3, 4, 5];     
     
print("Elements of given array: ");    
#Loop through the array by incrementing the value of i     
    
for i in range(0, len(arr)):    
    print(arr[i]),    

 


Output:

Elements of given array:
1    2    3    4    5