LINEAR DATA Unit 1
STRUCTURES
, PYTHON - ARRAYS
❑Element− Each item stored in an array is called an element.
❑Index − Each location of an element in an array has a numerical index, which is used to
identify the element.
❑Index starts with 0.
❑Array length is 10 which means it can store 10 elements.
❑Each element can be accessed via its index.
,BASIC OPERATIONS
❑Traverse − print all the array elements one by one.
❑Insertion − Adds an element at the given index.
❑Deletion − Deletes an element at the given index.
❑Search − Searches an element using the given index or by the value.
❑Update − Updates an element at the given index.
, ARRAY CREATION IN
PYTHON
Syntax :-
from array import *
arrayName = array(typecode, [Initializers])
Example :-
from array import *
array1 = array('i', [10,20,30,40,50])
for x in array1:
print(x)