DEV Community

Tommi k Vincent
Tommi k Vincent

Posted on

Accessing Array Element in Python.

We can access each element of an array using the index of the element. The below code shows how to access an array element.

from array import * 

vincent = array('i',[30,40,50,60,70,80,70,100])

print(vincent[1])
print(vincent[2])
print(vincent[4])
Enter fullscreen mode Exit fullscreen mode

output:

40
50
70
Enter fullscreen mode Exit fullscreen mode

Top comments (0)