16. IF…ELSE

  • The ELSE statement is added at the bottom of the IF statement to do something different if the condition is not met
  • The example will execute one of the print statements, not both
#Declare variables
letter = "a"

#IF ELSE conditional statement
if letter == "a":
    print("the letter is a")
else:
    print("The letter is not a")

Tasks

  1. Modify your IF Selection program to use the ELSE statement
  2. Save and label your code

Extension Task

How could you use this technique to identify if a given number is greater, or less than zero?