2. Write a python program to reserve the sequence of the items in the arrays, array_a as provided in the following output.
The output is:
array_a = array('i', [1, 2, 3, 4, 5])
Expected Answer:
The initial array: array('b', [1, 2, 3, 4, 5])
After reversing the array: array('b', [5, 4, 3, 2, 1])
Sample Answer:
from array import * array_a = array('b', [1, 2, 3, 4, 5]) print("The initial array: "+str(array_a)) array_a.reverse() print("After reversing the array: "+str(array_a))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)