Skip to main content

Program to create a Numpy array filled with all ones

· One min read
Kaustubh Kulkarni

Code >

file.vb
import numpy as np
a = np.ones(3, dtype = int)
print("Matrix a:", a)
b = np.ones([4, 4], dtype = int)
print("Matrix b:", b)

Output >

Output
import numpy as np
a = np.ones(3, dtype = int)
print("Matrix a:", a)
b = np.ones([4, 4], dtype = int)
print("Matrix b:", b)