fx1 = 0 fx2 = 0 fx3 = 1 fx3 = 1 sx1 = 0 sx2 = 1 sx3 = 0 sx4 = 1 d1 = 0 d2 = 0 d3 = 0 d4 = 1 var1 = 0 var2 = 1 print "Enter INITIAL WEIGHTS FOR W1" nW1 = float(input("Enter W1 1st Initial Weights: ")) nW2 = float(input("Enter W2 2nd Initial Weights: ")) nW3 = float(input("Enter W3 3rd Initial Weights: ")) nW4 = float(input("Enter W4 4th Initial Weights: ")) print "Enter INITIAL WEIGHTS FOR W2" SnW1 = float(input("Enter W1 1st Initial Weights: ")) SnW2 = float(input("Enter W2 2nd Initial Weights: ")) SnW3 = float(input("Enter W3 3rd Initial Weights: ")) SnW4 = float(input("Enter W4 4th Initial Weights: ")) totalval =(fx1 * nW1) + (sx1*SnW1) - 0.2 count = 0 while count < 3: if(totalval >= 0): print ("ACTUAL OUTPUT:",var2) errorOutput = d1 - var2 if(totalval < 0): print ("ACTUAL OUTPUT:",var1) errorOutput = d1 - var1 print "ERROR OUTPUT USING AND GATE" print ("ERROR" , errorOutput) count = count + 1 print "Test Out"
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question