权重和偏置 import numpy as np # 求x1 and x2 def AND(x1, x2): x = np.array([x1, x2]) w = np.array([0.5, 0.5]) b = -0.7 # tmp = w[0]*x[0] + w[1]*x[1] + b tmp = np.sum(w * x) + b if tmp <= 0: return 0 else: return 1 print(AND(0,0), AND(0,1), AND(1,0), AND(1,1…