2. Write a Python Numpy program to generate 3x3 array and display the maximum and minimum of value in the 3x3 array.
The output is:
Expected Answer:
3x3 array:
[[0 1 2]
[3 4 5]
[6 7 8]]
Maximum value of the array:
8
Minimum value of the array:
0
Sample Answer:
import numpy as np a = np.arange(9).reshape((3, 3)) print("3x3 array:") print(a) print("\nMaximum value of the array:") print(np.amax(a)) print("Minimum value of the array:") print(np.amin(a))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)