Python Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 45)
45.
Given a NumPy array arr = np.array([2, 4, 6, 8, 10]), how do you extract elements at even indices?
arr[::2]
arr[1::2]
arr[1:][::2]
arr[1::]
Answer: Option
Explanation:
The code arr[::2] extracts elements at even indices from the array.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.