else Statements, online

Six activities your students do on their own devices. See who's finished, and their scores.

else Statements in one minute

What students need to know

else runs when the if condition is False — guarantees one block always runs. else needs only a colon — no condition, no parentheses.

else must always come last — after all if and elif blocks. else must follow an if — it can't exist on its own.

Mistakes students make

  • else does not take a condition just else: with no expression.
  • Missing colon after else.
  • else cannot stand alone it must follow an if or elif.
  • else must be lowercase Else is not valid Python.
PREVIOUS · MODULE 15elif Statements
YOU ARE HERE · MODULE 16else Statements
NEXT · MODULE 17Imports

Discover other journeys with this module

What students will learn in this module

Every question in Module 16

Quick questions

  1. When does else run?AAlwaysBWhen all if/elif conditions are False
  2. Does else have a condition?AYesBNo it catches everything left
  3. x = 2\nif x > 10:\n print('Big')\nelse:\n print('Small')\nWhat prints?ASmallBBig
  4. Where must else appear?AAfter the last if or elifBBefore if
  5. Can you have else without if?ANoBYes

Key terms

Students type the meaning of:

  • else
  • if/else
  • if/elif/else

Match the pairs

else x > 5:
    print('no')
Match it to what it does
else:
    print('no')
elif x > 2:
    print('mid')
Match it to what it does
if x > 0:
    print('pos')
else:
    print('neg')
Match it to what it does
else:
    print('other')
Match it to what it does
x = 2
if x > 5:
    print('big')
else:
    print('small')
Match it to what it does
x = 8
if x > 5:
    print('big')
else:
    print('small')
Match it to what it does

Fill in the blanks

  1. if x > 10:
        print('Big')
    ____:
        print('Small')
  2. if age >= 18:
        print('Adult')
    else_
        print('Minor')
  3. if score >= 50:
        print('Pass')
    ____:
        print('Fail')
  4. if name == 'Alice':
        print('Hi')
    ____:
        print('Unknown')
  5. if temp >= 30:
        _____('Hot')
    else:
        print('Cold')

Spot the error

Question 1

Aif x > 10:B    print('Big')Celse x <= 10:D    print('Small')

Question 2

Aif x > 10:B    print('Big')CelseD    print('Small')

Question 3

Aelse:B    print('Small')

Question 4

Aif x > 10:B    print('Big')CElse:D    print('Small')

Question 5

Aif x > 10:B    print('Big')Celse:Dprint('Small')