Alternative answer to question 19

This commit is contained in:
Haksell
2020-05-02 07:30:46 +02:00
parent 55d37d7819
commit 04f01dc162

View File

@@ -201,9 +201,7 @@ Create a 8x8 matrix and fill it with a checkerboard pattern (★☆☆)
hint: array[::2]
< a19
Z = np.zeros((8,8),dtype=int)
Z[1::2,::2] = 1
Z[::2,1::2] = 1
Z = np.array([[(i + j) % 2 for j in range(8)] for i in range(8)])
print(Z)
< q20