项目作者: jhannemann

项目描述 :
Print truth tables.
高级语言: Python
项目地址: git://github.com/jhannemann/truthtable.git
创建时间: 2020-09-24T02:31:05Z
项目社区:https://github.com/jhannemann/truthtable

开源协议:GNU General Public License v3.0

下载


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

  1. >>> from truthtable import print_truth_table
  2. >>> def AND(x, y):
  3. return x and y
  4. >>> print_truth_table(AND)
  5. AND(x, y):
  6. x|y|AND
  7. -------
  8. 0|0|0
  9. 0|1|0
  10. 1|0|0
  11. 1|1|1
  12. >>>