Basic Operations

  Python

Email

  • 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.

 

from array import *

name = array(‘i’,[43,5,4,3,2,24,5])

# this inser the value in arry

name.insert(1,39)
# this remove the value

name.remove(43)
#update the values
name[0]=20

#searching values

print(“this coding of the application of the best coding”,name.index(2))

for i in name:

print(i)

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of