Skip to content

jhannemann/truthtable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Print Truth Tables

This module exports a single function, print_truth_table, which takes a boolean function as an argument and prints the function's truth table.

The function uses the inspect module to derive the number and names of the function parameters automatically.

Example

>>> from truthtable import print_truth_table
>>> def AND(x, y):
	return x and y

>>> print_truth_table(AND)
AND(x, y):
x|y|AND
-------
0|0|0
0|1|0
1|0|0
1|1|1
>>>