>>> import numpy as np
>>> a = np.zeros((3, 3))
>>> a
array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
>>> a[0,0] = 1
>>> a
array([[1., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]])
>>> a[-1, 0] = 1
>>> a
array([[1., 0., 0.],
[0., 0., 0.],
[1., 0., 0.]])
>>> a[0, -1] = 1
>>> a
array([[1., 0., 1.],
[0., 0., 0.],
[1., 0., 0.]])
>>> a[-1, -1] = 1
>>> a
array([[1., 0., 1.],
[0., 0., 0.],
[1., 0., 1.]])
© 2024 OneMinuteCode. All rights reserved.