Twelve statements: Difference between revisions
Content deleted Content added
de-draft |
→{{header|Python}}: Add some explanation. |
||
Line 361: | Line 361: | ||
=={{header|Python}}== |
=={{header|Python}}== |
||
Note: we choose to adapt the statement numbering to zero-based indexing in the constraintinfo lambda expressions but convert back to one-based on output. |
|||
The program uses brute force to generate all possible boolean values of the twelve statements then checks if the actual value of the statements matches the proposed or matches apart from exactly one deviation. |
|||
<lang python> |
<lang python> |
||
from itertools import product |
from itertools import product |
||
Line 400: | Line 403: | ||
partial.append((st, matches)) |
partial.append((st, matches)) |
||
for |
for stm in full + partial: |
||
printer(* |
printer(*stm)</lang> |
||
{{out}} |
{{out}} |