{"library":"boolean-py","code":"import boolean\n\nalgebra = boolean.BooleanAlgebra()\n\n# Define symbols\nfever = algebra.Symbol('fever')\ncough = algebra.Symbol('cough')\nheadache = algebra.Symbol('headache')\n\n# Create expressions\nexpression_string = \"(fever | cough) & ~headache\"\nparsed_expression = algebra.parse(expression_string)\nprint(f\"Parsed expression: {parsed_expression}\")\n\n# Evaluate the expression for specific symptoms\npatient_symptoms = {\n    'fever': True,\n    'cough': False,\n    'headache': False\n}\n\nevaluated_expression = parsed_expression.subs(patient_symptoms)\nsimplified_result = evaluated_expression.simplify()\nprint(f\"Evaluated result for symptoms: {simplified_result}\")\n\n# Direct Python expression construction\nx, y, z = algebra.symbols('x', 'y', 'z')\nexpr2 = (x & y) | (~z)\nprint(f\"Python-constructed expression: {expr2}\")\nprint(f\"Simplified expr2: {expr2.simplify()}\")","lang":"python","description":"This quickstart demonstrates how to initialize a `BooleanAlgebra` instance, define symbols, parse boolean expressions from strings, and construct them directly using Python operators. It also shows how to evaluate expressions by substituting symbol values and then simplifying them.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}