Chapter1/ZeroMatrix.py
def ZeroMatrix(size, data): 
    '''To Zero the row and column if elment is zero'''
    row = [0]*size
    column = [0]*size
    for i in range(size):
        for j in range(size):
            if not data[i][j]:
                row[i]=column[j]=1

    for i in range(size):
        if row[i]:
            data[i]=[0]*size
            continue
        for j in range(size):
            if column[j]: data[i][j]=0    
    return data
To Zero the row and column if elment is zero
To Zero the row and column if elment is zero
To Zero the row and column if elment is zero
def ZeroMatrix(size, data): 
    row = [0]*size
    column = [0]*size
    for i in range(size):
        for j in range(size):
            if not data[i][j]:
                row[i]=column[j]=1
    for i in range(size):
        if row[i]:
            data[i]=[0]*size
            continue
        for j in range(size):
            if column[j]: data[i][j]=0    
    return data
def ZeroMatrix ( size , data ) : row = [ 0 ] * size column = [ 0 ] * size for i in range ( size ) : for j in range ( size ) : if not data [ i ] [ j ] : row [ i ] = column [ j ] = 1 for i in range ( size ) : if row [ i ] : data [ i ] = [ 0 ] * size continue for j in range ( size ) : if column [ j ] : data [ i ] [ j ] = 0 return data
To Zero the row and column if elment is zero
To Zero the row and column if elment is zero
'''To Zero the row and column if elment is zero'''
size
data