参考python代码如下 #perceptron x=[[1 ,0, 0],[1,0,1],[1, 1, 0],[1, 1, 1],[0,0,1],[0,1,0],[0,1,1],[0,0,0]] y=[-1,1,1,1,-1,-1,1,-1]#真值 y_pre=[0,0,0,0,0,0,0,0]#初始化 _DEBUG=True w=[0 ,0 ,0 ,0.0] lamu=0.1#学习因子 while 1: sum=0 for i in range(len(y)): y_pre[i]=((x[i…