DEV Community

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

Posted on

Arrays in Python

Array is a container which can hold a fixed number of items and these items are of the same type.

Important Terms in arrays:
1 Element - items stored in an array.
2 Index - location of each element in an array and has a numerical index that used for identification.

Basic Operation that can be carried in an array
1 Traverse - printing all elements one by one.
2 Insertion -adding an element to an array.
3 Deletion - Deleting an element at a given position.
4 Search - Searching an element at a given index or value
5 Update - Updating an element at a given position.

Array Example:

from array import *
   vincente =  array('i',[10,20,30,40,50]

     for x in vincente:
           print(vincent
Enter fullscreen mode Exit fullscreen mode

e)

output:

10
20
30
40
50
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