def aandb ( a , b ) : return matrix ( np . logical_and ( a , b ) . astype ( 'float' ) , a . size )
how to use multiple logical opetators in python
Return a matrix of logic comparison of A or B
def aandb(a, b):
    """Return a matrix of logic comparison of A or B"""
    return matrix(np.logical_and(a, b).astype('float'), a.size)