用np.random.randint()方法定义一个整数型随机二维矩阵,并判断其中有没有一整列数为0,返回布尔值,写成一个函数,求大神指点。用python写,谢谢。
import numpy as np def foo(m): return np.array([max(x) == 0 for x in m.T]).any() m = np.random.randint(0, 3, 60).reshape(3, 20) print(m) print(foo(m))