×

python · level 1 · unit 4 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

adds more paths to the fork.

Some questions have more than two answers. What should you wear? It depends how cold it is. elif, short for else if, adds another condition to check when the ones above it were False.

Python checks from the top down and stops at the first condition that is True. Only that path runs. Stack as many elif lines as you like, then add an else to catch the rest.

Every gives True or False. < means less than, > more than, <= less than or equal to, >= more than or equal to, and != not equal to.

temperature = 12
if temperature < 5:
    print("Wear a big coat.")
elif temperature < 15:
    print("A jumper will do.")

In <= and >= the = always comes second, never first.