Test you knowledge about conditional operators!
Image of therapy dogs with their names.

derek_color = 'cream'
wagner_color = 'black'
josie_color = 'cream'
derek_color == wagner_color = ?

What does derek_color == wagner_color evaluate to?
Choose an answer above!
  • Let's learn a very important concept for if-statements: Conditional Operators.
  • A conditional operator is similar to a mathematical operator(+, -). However, a conditional operator's result is always True or False -- a Boolean!
  • Remember we learned about Booleans in the previous book about variables.
  • Here are some common conditional operators:
  • 1. Use "==" to check if two values are equal or the same.
  • 2. Use "<" to check if one value is less than another.
  • 3. use ">" to check if one value is greater than another.
  • Here are some examples:
  • 5 == 5 will be True
  • 5 + 5 == 10 will be True
  • 5 < 5 will be False