4. Write a python program to remove the specified item from the initial arrays, array_a as provided in the following output.
The output is:
array_a = array('b', [0, 1, 2, 3, 4, 5])
remove number: 2
Expected Answer:
The initial array: array('b', [0, 1, 2, 3, 4, 5])
Remove the number '2' from the initial array:
New array: array('b', [0, 1, 3, 4, 5])
Sample Answer:
from array import *
array_a = array('b', [0, 1, 2, 3, 4, 5])
print("The initial array: "+str(array_a))
print("Remove the number '2' from the initial array:")
array_a.pop(2)
print("New array: "+str(array_a))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)