1- """ A NOR Gate is a logic gate in boolean algebra which results to false(0)
2- if any of the input is 1, and True(1) if both the inputs are 0.
3- Following is the truth table of an NOR Gate:
1+ """
2+ A NOR Gate is a logic gate in boolean algebra which results to false(0)
3+ if any of the input is 1, and True(1) if both the inputs are 0.
4+ Following is the truth table of a NOR Gate:
45 | Input 1 | Input 2 | Output |
56 | 0 | 0 | 1 |
67 | 0 | 1 | 0 |
78 | 1 | 0 | 0 |
89 | 1 | 1 | 0 |
10+
11+ Following is the code implementation of the NOR Gate
912"""
10- """Following is the code implementation of the NOR Gate"""
1113
1214
1315def nor_gate (input_1 : int , input_2 : int ) -> int :
@@ -30,11 +32,11 @@ def nor_gate(input_1: int, input_2: int) -> int:
3032
3133def main () -> None :
3234 print ("Truth Table of NOR Gate:" )
33- print ("| Input 1 |" , " Input 2 |" , " Output |" )
34- print ("| 0 |" , " 0 | " , nor_gate (0 , 0 ), " |" )
35- print ("| 0 |" , " 1 | " , nor_gate (0 , 1 ), " |" )
36- print ("| 1 |" , " 0 | " , nor_gate (1 , 0 ), " |" )
37- print ("| 1 |" , " 1 | " , nor_gate (1 , 1 ), " |" )
35+ print ("| Input 1 | Input 2 | Output |" )
36+ print (f "| 0 | 0 | { nor_gate (0 , 0 )} |" )
37+ print (f "| 0 | 1 | { nor_gate (0 , 1 )} |" )
38+ print (f "| 1 | 0 | { nor_gate (1 , 0 )} |" )
39+ print (f "| 1 | 1 | { nor_gate (1 , 1 )} |" )
3840
3941
4042if __name__ == "__main__" :
0 commit comments