Skip to content

Commit 7795fef

Browse files
AkshajV1309techyminati
authored andcommitted
Create orgate.py
1 parent ed7a00e commit 7795fef

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

orgate.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
''' An OR Gate is a logic gate in boolean algebra which results to True(1) if any of the input is
2+
1, OR False(0) if both the inputs are 0.
3+
Following is the truth table of an OR Gate:
4+
| Input 1 | Input 2 | Output |
5+
| 0 | 0 | 0 |
6+
| 0 | 1 | 1 |
7+
| 1 | 0 | 1 |
8+
| 1 | 1 | 1 |
9+
'''
10+
'''Following is the code implementation of the OR Gate'''
11+
12+
def OR_Gate(input_1,input_2):
13+
if input_1 == input_2 == 0:
14+
return 0
15+
else:
16+
return 1
17+
if __name__== '__main__':
18+
print('Truth Table of OR Gate:')
19+
print('| Input 1 |',' Input 2 |',' Output |')
20+
print('| 0 |',' 0 | ',OR_Gate(0,0),' |')
21+
print('| 0 |',' 1 | ',OR_Gate(0,1),' |')
22+
print('| 1 |',' 0 | ',OR_Gate(1,0),' |')
23+
print('| 1 |',' 1 | ',OR_Gate(1,1),' |')
24+
25+
'''Code provided by Akshaj Vishwanathan'''

0 commit comments

Comments
 (0)