Five pages of coding with no computer. Code is drawn as blocks: an if-then block runs the steps inside it only when its test is true, and its else part runs when the test is false. Page 1 has four number machines with if-then-else rules; students write the number that comes out for each number that goes in. Page 2 sorts ten numbers into boxes A, B and C with a rule of two checks, then asks which numbers change boxes when the checks are swapped. Page 3 traces loops with a condition inside, including for-each loops that count or add up numbers from a list. Page 4 runs each program against its goal, finds the line with the bug and writes the fix. Page 5 runs two programs that give the same result and circles the shorter, more efficient one.
Act out a number machine: one student holds a card with an if-then rule, others bring numbers to it and the class decides which way each number goes. On page 4, ask students to test the fixed code with a second number before they are sure. Page 5 is a good start for talking about efficient code: fewer steps that do the same job.
Make up an if-then rule together, such as if the number is even, halve it, else add 1, and take turns giving each other numbers to run through it. Then ask what happens if you start at 10 and keep running the rule.
This pack supports the following Common Core State Standards for Mathematics:
© Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.
Unplugged coding with conditions: if-then-else blocks inside number machines, sorting rules and loops. Students run programs, sort numbers, trace loops, find and fix bugs and choose the shorter of two programs that do the same thing.
Tell us what to make next, or build your own with a worksheet maker.
This worksheet is free to download, print, copy, and hand out in your classroom or at home. You do not need to create an account, and there are no watermarks on the PDF.