mitabla=[]encabezado=["p","q","not q","p and not q","not( p and not q)"]mitabla.append(encabezado)forpin[True,False]:forqin[True,False]:renglon=[int(p),int(q),int(notq),int(pandnotq),int(P(p,q))]mitabla.append(renglon)show(table(mitabla))
print(latex(table(mitabla)))
\begin{tabular}{lllll}
p & q & not q & p and not q & not( p and not q) \\
$1$ & $1$ & $0$ & $0$ & $1$ \\
$1$ & $0$ & $1$ & $1$ & $0$ \\
$0$ & $1$ & $0$ & $0$ & $1$ \\
$0$ & $0$ & $1$ & $0$ & $1$ \\
\end{tabular}