Python program to print the elements of an array present on even position

bookmark

#Initialize array     
arr = [1, 2, 3, 4, 5];     
     
print("Elements of given array present on even position: ");    
#Loop through the array by incrementing the value of i by 2    
    
#Here, i will start from 1 as first even positioned element is present at position 1.    
for i in range(1, len(arr), 2):    
    print(arr[i]);   

 


Output:

Elements of given array present on even position:
2
4