1. Write a python program to add on one number into the following array, array_a
The output is:
array_a = array('i', [1, 2, 3, 4, 5])
Expected Answer:
Initial array: array('i', [1, 2, 3, 4, 5])
Append 6 at the end of the array:
New array: array('i', [1, 2, 3, 4, 5, 6])
Sample Answer:
from array import * array_a = array('i', [1, 2, 3, 4, 5]) print("Initial array: "+str(array_a)) print("Append 6 at the end of the array:") array_a.append(6) 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)