Summary

In this lab, we covered several major important topics. Let’s quickly review them.

Booleans in Pseudocode

  • true
  • false
  • BOOLEAN() procedure to convert values
    • 0 is false, and any other number is true

Pseudocode Boolean Operators

  • AND
  • OR
  • NOT

Pseudocode Boolean Comparators

  • = equal
  • != not equal
  • < less than
  • <= less than or equal to
  • > greater than
  • >= greater than or equal to

Booleans in Python

  • True
  • False
  • bool() procedure to convert values
    • If the input is the value False, the value 0, the value None, or anything with 0 length, including the empty string, it will return False.
    • Otherwise, for all other values it will return True.

Python Boolean Operators

  • and
  • or
  • not

Python Boolean Comparators

  • == equal
  • != not equal
  • < less than
  • <= less than or equal to
  • > greater than
  • >= greater than or equal to

Comparators and Strings

Strings are compared using lexicographic order

Boolean Order of Operations

  1. Math operators (following their order of operations)
  2. Boolean comparators
  3. not
  4. and
  5. or