Week 10: Mar 10-14

Computer systems - Using Boolean Logic in programming:

Learning objectives:

  • Understand the concept of Boolean logic
  • Apply Boolean logic to solve coding problems
  • Practice implementing Boolean logic in Python programs

Classroom activity:

Using Boolean logic in programming

Building up complex decisions with Boolean expressions

Boolean logic does not just work with numbers. Boolean expressions can also compare text, for example to check if a password is correct.

Consider this Python (3.x) program, which repeats if a password has been entered incorrectly: