Teaching Materials
What is new in this level?
This level builds on the new if and else commands from the previous level. With if and else, you add two choices to your code. In this level, students learn to add more options with elif. It is important that students learn to place if, elif, and else on separate lines. In addition, students learn to use in to check whether an answer is in a list.
New in this level:
- Adding multiple choices with
elif - Checking whether something is in a list with
in
- Slides Present the level, one concept at a time
- Workbook Exercises to print, away from the screen Work in progress
Common mistakes
Students use 1 line for an if statement
Students sometimes try to put everything on one line. This is no longer allowed.
animal is ask 'What is your favorite animal?' if animal is dog print 'I love dogs too!' elif animal is cat print 'Cats are okay' else print 'Cool animal'
From this level on, you not only need to put if and else on seperate lines. You also need to seperate the conditional and the comamnd on seperate lines. Like this:
animal is ask 'What is your favorite animal?' if animal is dog print 'I love dogs too!' elif animal is cat print 'Cats are okay' else print 'Cool animal'
Students use elif like else, so without a conditional
Students forget that they need a conditional
color is ask 'What is your favorite color? if color is green print 'I love green too!' elif print 'I like green'
Add a conditional
color is ask 'What is your favorite color? if color is green print 'I love green too!' elif color is blue print 'Blue is okay' else print 'I like green'
Students use in without a list
Students forget that they need a list
if chosen_color in pretty_colors print 'Great choice!'
Add a list
pretty_colors is blue, green, purple if chosen_color in pretty_colors print 'Great choice!'