How to generate a matrix with border 1's and 0's at the core when we give m and n positive integers.
Input:
4,5
Output
[1, 1, 1, 1, 1]
[1, 0, 0, 0, 1]
[1, 0, 0, 0, 1]
[1, 1, 1, 1, 1]
I used this code.Is there any other way to get the output
import numpy as np
a=np.ones((m,n),dtype="int")
a[1:-1,1:-1]=0