#NEWLINE# def find_0_MxN( m ) : #NEWLINE# #INDENT# ' find 0s in a matrix and replace the col and row to 0s:\n    >>> m1 = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]]\n    >>> find_0_MxN(m1)\n    [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]\n    >>> m2 = [[1, 2, 3, 4], [0, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]\n    >>> find_0_MxN(m2)\n    [[0, 2, 3, 4], [0, 0, 0, 0], [0, 10, 11, 12], [0, 14, 15, 16]]\n    ' #NEWLINE# index = [ ] #NEWLINE# for row in range ( len ( m ) ) : #NEWLINE# #INDENT# for col in range ( len ( m [ 0 ] ) ) : #NEWLINE# #INDENT# if ( m [ row ] [ col ] == 0 ) : #NEWLINE# #INDENT# index . append ( ( row , col ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for i in index : #NEWLINE# #INDENT# row = i [ 0 ] #NEWLINE# col = i [ 1 ] #NEWLINE# for i in range ( len ( m ) ) : #NEWLINE# #INDENT# m [ row ] [ i ] = 0 #NEWLINE# #UNINDENT# for i in range ( len ( m [ 0 ] ) ) : #NEWLINE# #INDENT# m [ i ] [ col ] = 0 #NEWLINE# #UNINDENT# #UNINDENT# return m