Write a NumPy program to create a new array of 3*5, filled with 2
import numpy as np #using no.full x = np.full((3, 5), 2, dtype=np.uint) print(x) #using no.ones y = np.ones([3, 5], dtype=np.uint) *2 print(y)
Sample Output:
[[2 2 2 2 2] [2 2 2 2 2] [2 2 2 2 2]] [[2 2 2 2 2] [2 2 2 2 2] [2 2 2 2 2]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer