Skip to content

Latest commit

 

History

History
 
 

10 - Complex conditon checks

Complex condition checks

Conditional execution can be completed using the if statement.

if syntax

if expression:
    # code to execute
elif expression:
    # code to execute
else:
    # code to execute

Boolean values can be either False or True

Boolean operators

  • x or y - If either x OR y is true, the expression is executed
  • x and y - If x AND y are both true, the expression is executed

Comparison operators

  • < less than
  • < greater than
  • == is equal to
  • >= greater than or equal to
  • <= less than or equal to
  • != not equal to
  • x in [a,b,c] Does x match the value of a, b, or c