Lab 3: Making Decisions

Students build various predicates (examples below) and use them with keep to perform various queries on a list of words to solve a crossword puzzle.
does (orange) have (6) letters? reporting true is letter (4) of (carrot) the letter (o)? reporting false

Predicates are reporters that report only Boolean values: true or false. Students have used predicates with conditionals such as if and repeat until.

Students learn to build new predicates by combining basic predicates (like = or >) with operations like length of or letter 1 of, or the mod block (which reports the remainder when a number is divided by another).
(17) mod (5) reporting 2
Then they learn to combine their predicates into more complex predicate expressions using Boolean operators (and, or, and not), so that they can select list items that meet multiple criteria.

Pacing

The 6 lab pages could be split across 4–7 days (140–280 minutes). Expected times to complete follow:

Lab Pages

Solutions

Correlation with 2020 AP CS Principles Framework 

Computational Thinking Practices: Skills

Learning Objectives:

Essential Knowledge: