lehrkraefte:sbtsnr:python:logic

This is an old revision of the document!


wahrheitstabelle.py
"""
Print of Logic tables
"""
import operator
 
anzahlVariablen = 2
x1 = False
x2 = False
 
for index in range(2**anzahlVariablen):
    print(
        f"{index}  | {x2} {x1}   |   {x2 and x1}    {x2 or x1}     {x2 ^ x1}"
    )
    x1 = not x1
    if (index + 1) % 2 == 0:
        x2 = not x2
  • lehrkraefte/sbtsnr/python/logic.1664554086.txt.gz
  • Last modified: 2022/09/30 18:08
  • by Karlheinz Schubert