- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
#to create array import array module
#array.array(data type,value list)
#append() use to insert value in the end
#insert() use to enter value at the specific postion
#"i" is data typw which is stand for signed int
import array
arr=array.array("i",[1,2,3])
print("The new created array is :",end=" ")
for i in range(0,3):
print(arr[i],end=" ")
print("\r")
arr.append(4)
print("The appended array is : ", end="")
for i in range(0,4):
print(arr[i],end=" ")
print("\r")
arr.insert(2,5)
print("The array after insertion is :",end=" ")
for i in range(0,5):
print(arr[i],end=" ")
print("\r")
- Get link
- X
- Other Apps
Comments
Post a Comment