Given a single positive odd integer 'n' greater than 2, create a NumPy array of size (n x n) with all zeros and ones such that the ones make a shape like '+'. The lines of the plus must be present at the middle row and column.
Answers
Answered by
1
Answer:
I have images.
PLS FOLLOW ME GUY'S ❤❤❤
Attachments:
Answered by
5
Answer:
n = int(input())
import numpy as np
# Create an (n x n) array with all zeroes
z = np.zeroes((n,n), dtype= int)
# Make the middle row and middle column all 1s
z[n//2, :] = 1
z[: , n//2] = 1
#Print the value of z
print(z)
Explanation:
Similar questions