Array Methods

1. Insert Method

from array import*

ks=array('i',[1,4,5,6])
for k in ks:
print(k)
print("after insert methode")

ks.insert(3,1025) #This is the insert method where 3 is index number and 1025 is
# value that you want to insert
for k in ks:
print(k)


2.Pop Method

from array import*

ks=array('i',[1,4,5,6])
for k in ks:
print(k)
print("after pop methode")
ks.pop() # it will remove last element
for k in ks:
print(k)

Comments

Popular posts from this blog

React Installation with Vite and Tailwind css (Steps to Installation)

Insert Data In mongoDb

Class methods as an alternative Constructor