How to create 2D array (matrix) with consecutive numbers from 0 with numpy in Python

1 Answer

0 votes
import numpy as np

matrix = np.arange(12).reshape(4, 3)
print(matrix)



'''
run:

[[ 0  1  2]
 [ 3  4  5]
 [ 6  7  8]
 [ 9 10 11]]

'''

 



answered Jun 24, 2023 by avibootz
...