python create a matrix with one in diagonal
# Create a matrix in python and fill
import numpy as np
a = np.zeros((3, 3), int) # Create matrix with only 0
np.fill_diagonal(a, 1) # fill diagonal with 1
print(a)
python create a matrix with one in diagonal
# Create a matrix in python and fill
import numpy as np
a = np.zeros((3, 3), int) # Create matrix with only 0
np.fill_diagonal(a, 1) # fill diagonal with 1
print(a)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us