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
who here likes raw 1-liners?
>>> truthtable = lambda n: [[(v>>i)&1 for i in range(n-1,-1,-1)] for v in range(1<0 else [[]]
100% tested and working. (can't copy/paste result, or above code, cause I'm on a phone for Internet)