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