The number of rows and columns is the number you want, and I want to randomize the contents of the matrix.

Asked 1 years ago, Updated 1 years ago, 216 views

I would like to define the number of matrix contents (1-10) as an integer random number after defining row = 1 column = 3 in the matrix.
I'm a Python beginner.
Thank you for your cooperation.

python pycharm

2022-12-29 17:07

1 Answers

import numpy as np
M = 3
N = 1
X = np.random.randint (1,11,(M,N))
print(X)


2022-12-30 22:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.