Twelve statements: Difference between revisions

m
m (→‎{{header|Python}}: Consistency with output)
Line 470:
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. PythonsPython's boolean type <tt>bool</tt>is a subclass of <tt>int</tt>, so boolean values True, False arecan convertedbe toused theas integerintegers values(1, one0, zerorespectively) in numerical contexts. This fact is used in the lambda expressions that use function sum.
<lang python>
from itertools import product
Anonymous user