Question: In Python, Create a file named truthTable.py which contains a function named printTruthTable. printTruthTable will take one argument that is a string. def printTruthTable(logicalOperation): true
In Python,
Create a file named truthTable.py which contains a function named printTruthTable. printTruthTable will take one argument that is a string.
def printTruthTable(logicalOperation):
true = 1>0
false = 1<0
if logicalOperation=='and':
print(..
You need to create the function so that it will print out the truth table for
1. and when logicalOperation == "and"
2. or when logicalOperation == "or".
3. not when logicalOperation == "not".
The answer is one of three:
1.
True and True is True
True and False is False
False and True is False
False and False is False
2.
True or True is True
True or False is True
False or True is True
False or False is False
3.
not True is False
not False is True
You don't have to do anything fancy to print a truth table. Print statements are OK. Use Python to calculate the and, or and not operations.
The function should handle the special case when the argument sent in is neither 'and' nor 'or' not not
>>>printTruthTable("and")
True and True is True
True and False is .
.
OR
>>>printTruthTable("or")
..
.
.
.
OR
>>>printTruthTable("not")
..
.
OR
>>>printTruthTable("bla bla bla")
You sent in bla bla bla which is not a legal input!!!!!!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
