Python program to remove a specified item using array index.

In the above Python program to remove an item from an array using index value, we have used a built in method pop() which will remove the item passed inside it and print the new array.

from array import *
arr_num = array('i', [4, 7, 3, 8, 1, 6])
print("Original array: "+str(arr_num))
print("Remove the fourth item form the array:")
arr_num.pop(3)
print("New array after deletion of the fourth item: "+str(arr_num))
Sample Output:
Original array: array('i', [4, 7, 3, 8, 1, 6])
Remove the fourth item form the array:
New array after deletion of the fourth item: array('i', [4, 7, 3, 1, 6])