17. IF…ELIF…ELSE

  • You can check a variable for many different conditions using ELIF
#Declare variable
letter = "a"

#IF ELIF ELSE conditional statement
if letter == "a":
    print("The letter is a")
elif letter == "b":
    print("The letter is b")
else:
    print("The letter is not a or b")

Tasks

  1. Modify your IF ELSE program to use the ELIF statement to check for the letters a-f
  2. Save and label your code