efinf:blcks2017:bitsundbytes:logischeoperatoren

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
efinf:blcks2017:bitsundbytes:logischeoperatoren [2017/09/25 13:06] – created Ivo Blöchligerefinf:blcks2017:bitsundbytes:logischeoperatoren [2017/09/26 10:01] (current) – [Wahrheitstabellen] Ivo Blöchliger
Line 1: Line 1:
 +{{backlinks>.}}
 +====== Wahrheitstabellen ======
 +<code python truthtable.py>
 +def truthTable(op,numvar,title):
 +    print title
 +    print "-"*8*(numvar+2)
 +    for v in range(1 << numvar):
 +        l=[]
 +        for i in range(numvar):
 +            l.append((v>>i & 1)==1);
 +            print l[-1],
 +            print "\t",
 +        print "|\t",op(l)
 +    print
  
 +truthTable(lambda x:not x[0],1,"A\t|\tnot A");
 +truthTable(lambda x:x[0] and x[1],2,"A\tB\t|\tA and B");
 +truthTable(lambda x:x[0] or x[1],2,"A\tB\t|\tA or B");
 +
 +</code>
 +
 +
 +Spielen mit logischen Schaltungen: http://www.cburch.com/logisim/ oder online https://simulator.io/board