Home / Expert Answers / Computer Science / 3-write-a-function-called-border-m-n-that-returns-an-m-by-n-matrix-with-1-pa377

(Solved): 3) Write a function called border \( (m, n) \) that returns an \( m \) by \( n \) matrix with \( 1 ...



3) Write a function called border \( (m, n) \) that returns an \( m \) by \( n \) matrix with \( 1 \mathrm{~s} \) on its bord

3) Write a function called border \( (m, n) \) that returns an \( m \) by \( n \) matrix with \( 1 \mathrm{~s} \) on its border, 0s elsewhere. For example, border \( (5,4) \) should return, \( [[1,1,1,1] \), \( [1,0,0,1] \), \( [1,0,0,1] \), \( [1,0,0,1] \), \( [1,1,1,1]] \) 4) Write a function called stripes( \( n) \) that returns an n by n matrix with alternating stripes of \( 0 \mathrm{~s} \) and \( 1 \mathrm{~s} \). For example, stripes(5) should return \[ [[1,1,1,1,1] \text {, } \] \( [0,0,0,0,0] \) \( [1,1,1,1,1] \), \( [0,0,0,0,0] \), \( [1,1,1,1,1]] \)


We have an Answer from Expert

View Expert Answer

Expert Answer


Logic to implement this code: border(m,n): create an empty list loop for m times -- create an
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe