DEV Community

I'm Just a Guy with a Computer
I'm Just a Guy with a Computer

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more