3. Write a python program to access the last three items in the arrays, array_a as provided in the following output.
The output is:
array_a = array('b', [1, 2, 3, 4, 5])
Expected Answer:
The initial array:
1
2
3
4
5
Access last three items individually
3
4
5
Sample Answer:
from array import * array_a = array('b', [1, 2, 3, 4, 5]) print("The initial array:") for i in array_a: print(i) print("Access last three items individually") print(array_a[2]) print(array_a[3]) print(array_a[4])
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)