Question
How do you access a specific element in a Python array using its index?
Asked by: USER6334
71 Viewed
71 Answers
Responsive Ad After Question
Answer (71)
You access elements in a Python array (using the `array` module or NumPy arrays) using square bracket notation `[]`. The index starts at 0 for the first element. For example, `my_array[0]` accesses the first element, `my_array[1]` the second, and so on. Negative indices can also be used, where `my_array[-1]` accesses the last element, `my_array[-2]` the second to last, and so forth.