Question: Write a program in Python 3.8 representing 7 logic gates: AND NAND OR NOR XOR XNOR NOT Accept (only) two inputs to create all outputs.
Write a program in Python 3.8 representing 7 logic gates:
- AND
- NAND
- OR
- NOR
- XOR
- XNOR
- NOT
- Accept (only) two inputs to create all outputs.
- Use the if statement to perform the Boolean logic.
- Only accept numeric input.
- If a number is greater than 0 treat it as a 1.
- Specify in your output and in the beginning of the code (through print statements) which gate the code represents.
- Comment your code.
Please Explain how you do it please. Thanks. I am mostly confused on how to program a number greater than 0 to be treated as a 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
