Math Bonk! Learning Centre Play the game

Worksheet for the lesson Coding with Loops · All worksheets

Coding with Loops

Grade 3 math worksheet · mathbonk.com/learn

Name: ______________________   Date: ____________

Look

A grid of stamps that is 4 rows tall and 3 columns wide, with arrows showing an outer loop and an inner loopinner loop: 3 timesouter loop: 4 times
  1. repeat 4 [repeat 3 [stamp]] makes this grid. How many stamps in all?
  2. How many rows of stamps are there?
  3. How many stamps are in each row?

Practice

  1. A robot runs: repeat 5 times: step forward. How many steps does it take?
  2. A robot runs: repeat 4 times: forward 2, turn right. How many squares does it move forward in total?
  3. repeat 3 times: [ clap 2 times, stomp 1 time ]. How many claps are there in all?
  4. For the same program, how many actions are there in total (claps and stomps)?
  5. repeat 2 times: [ repeat 3 times: [ clap ], stomp ]. How many claps are there in total?
  6. For the same nested program, how many stomps are there?
  7. repeat 4 times: forward 3, turn right a quarter turn. What shape is drawn?
  8. A robot must move forward 12 squares using only the command "forward 2". How many times should the command repeat?
  9. Write "step, step, step, step, step, step" using a loop.
  10. A program to draw a square says "repeat 3 times: forward 2, turn right a quarter turn". How many times should it repeat?

Think it through

  1. Draw what repeat 3 [forward 2, turn right] traces.
  2. Explain why a loop inside a loop makes more steps than one loop.

Challenge

  1. How many steps are in repeat 2 [repeat 4 [forward 1, turn]]?
  2. A robot draws a triangle with repeat 3 [forward 5, turn]. What kind of turn is it?

Answer key

Look

  1. 12
  2. 4
  3. 3

Practice

  1. 5
  2. 8
  3. 6
  4. 9
  5. 6
  6. 2
  7. A square
  8. 6
  9. repeat 6 times: step
  10. 4

Think it through

  1. Three sides of a square, each 2 squares long
  2. The inner loop runs again every time the outer loop runs, so the counts multiply

Challenge

  1. 16
  2. One third of a full turn, 120°