Printing Random 1-d Arrays In Python
This code gives 2D arrays but I need multiple 1-dimensional arrays with random numbers. a,b,c,d,e=[],[],[],[],[] for i in (a,b,c,d,e): j=np.random.randint(0,15,size=7) i.
Solution 1:
You append numpy array to a list, so you got 2D. Try this
import numpy as np
a, b, c, d, e = (np.random.randint(0,15,size=7) for i in range(5))
print(a,b,c,d,e)
Post a Comment for "Printing Random 1-d Arrays In Python"