Home >>Python Programs >Python program to print the elements of an array present on even position
In this example, we will see a Python program through which we can print the elements of an array present on even positions.
Even position element can be found by traversing the given array and incrementing the value of i by 2. In this way the i will initialize with 1 and after incrementing it will be 3, 5, 7, 9, etc. because the array indexing starts with 0.
#Initialize array
arr = [9,10,11,12,13,14,15];
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]);