Write a NumPy program to create an array of 10 zeros, 10 ones, 10 fives
import numpy as np array=np.zeros(10) print("An array of 10 zeros:") print(array) array=np.ones(10) print("An array of 10 ones:") print(array) array=np.ones(10)*5 print("An array of 10 fives:") print(array)
Sample Output:
An array of 10 zeros: [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] An array of 10 ones: [ 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.] An array of 10 fives: [ 5. 5. 5. 5. 5. 5. 5. 5. 5. 5.
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