LessonPort Python Boolean Logic LabAP Computer Science · comparisons and logic
SCORE0STREAK0
PYTHON · BOOLEAN EXPRESSIONS
Ask a question.
Get True or False.
Boolean expressions help programs make decisions. Compare values, combine conditions with and and or, reverse results with not, and prove equivalence with truth tables.
Learning target Evaluate and rewrite Python Boolean expressions, including compound conditions and De Morgan’s Laws.
SIMULATION 1 · COMPARISONS
Build a comparison expression
Change both values and select a comparison operator. Python immediately evaluates the question.
PYTHON EXPRESSION
8 > 5evaluates toTruePython asks: “Is 8 greater than 5?” The answer is the Boolean value True.