Skip to content

Commit b8281d7

Browse files
author
Kuldeep Borkar
authored
Fixed a typo of 'a' and 'an' and used f string in print statement (TheAlgorithms#7398)
1 parent 80ff25e commit b8281d7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

boolean_algebra/norgate.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
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

1315
def nor_gate(input_1: int, input_2: int) -> int:
@@ -30,11 +32,11 @@ def nor_gate(input_1: int, input_2: int) -> int:
3032

3133
def 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

4042
if __name__ == "__main__":

0 commit comments

Comments
 (0)