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

bookmark

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

 


Output:

Elements of given array present on odd position:
1
3
5