Programming and Algorithms

An algorithm is a list of exact steps for completing a task, and a program is code a computer can run. Students trace and write steps with conditionals, loops and variables, and find and fix bugs.

Topics are chosen by LessonRally.

Filter by grade
About teaching Programming and Algorithms
What students practice
Following numbered steps in order, reading “10 or more” as x ≥ 10 and “more than 14” as x > 14, and counting that the steps of an inner loop of 3 inside an outer loop of 2 run 6 times.
Common mistakes
Students often read x = x + 1 as an equation that cannot be true; in Python it means add 1 to x and store the result. Many count 14 as more than 14; have them test the boundary value. Others swap with a = b and then b = a, which leaves both holding b’s original value.
Ways to use these activities
Use one of these activities before an unplugged task in which students write exact directions for a partner to draw a simple shape, then revise the steps that fail. In pairs, one student traces a short program aloud while the other records each variable’s value in a table.