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.
Share
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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
I have images.
PLS FOLLOW ME GUY'S ❤❤❤
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: