My question is simple: \"how to build a dynamic growing truth table in python in an elegant way?\"
for n=3
for p in False, True: for q in False, Tru
Use itertools.product():
table = list(itertools.product([False, True], repeat=n))
Result for n = 3:
n = 3
[(False, False, False), (False, False, True), (False, True, False), (False, True, True), (True, False, False), (True, False, True), (True, True, False), (True, True, True)]