You are on page 1of 1

Practical No.

2
CODE:
a=[0,0,1,1]

b=[0,1,0,1]

z=[0,0,1,0]

while True:

w1=int(input("enter weight 1:"))

w2=int(input("enter weight 2:"))

theta=int(input("enter theta:"))

y=[0 for _ in a]

for i in range(len(a)):

raw= w1*a[i]+w2*b[i]

if raw>= theta:

y[i]=1

if y==z:

print("weights matched")

print("neuron fired")

print("with output of neuron: ",z)

break

else:

print("output is: ",y)

print(" expected with output of neuron: ",z)

print("enter different values")

OUTPUT:

You might also like