Computer Science, asked by akshitahere777, 6 months ago

Write a Numpy program to create an array to 10 zeros,10 ones,10 fives.

Answers

Answered by pranavsatya2005
2

Answer:

Explanation:

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.]

Similar questions