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:
4
5
| Input 1 | Input 2 | Output |
5
6
| 0 | 0 | 1 |
6
7
| 0 | 1 | 0 |
7
8
| 1 | 0 | 0 |
8
9
| 1 | 1 | 0 |
10
+
11
+ Following is the code implementation of the NOR Gate
9
12
"""
10
- """Following is the code implementation of the NOR Gate"""
11
13
12
14
13
15
def nor_gate (input_1 : int , input_2 : int ) -> int :
@@ -30,11 +32,11 @@ def nor_gate(input_1: int, input_2: int) -> int:
30
32
31
33
def main () -> None :
32
34
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 )} |" )
38
40
39
41
40
42
if __name__ == "__main__" :
0 commit comments