1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| #!/usr/bin/env python3
# coding: utf-8
def base(A, B):
print("A=%d, B=%d, res=%d" % (A, B, not A or B))
def ligneA(A, B):
print("A=%d, B=%d, res=%d" % (A, B, (A and B) or (not A and B)))
def ligneB(A, B):
print("A=%d, B=%d, res=%d" % (A, B, (A and B) or (not A and B) or (not A and not B)))
def ligneC(A, B):
print("A=%d, B=%d, res=%d" % (A, B, (not A and B) or (not A and not B)))
def ligneD(A, B):
print("A=%d, B=%d, res=%d" % (A, B, (A and B) or (not A and not B)))
for (s, f) in (
("base", base),
("ligneA", ligneA),
("ligneB", ligneB),
("ligneC", ligneC),
("ligneD", ligneD),
):
print()
print(s)
for A in (False, True):
for B in (False, True):
f(A, B)
# for
# for |
Partager