An example of a Length of Straw Pieces Scratch Activity. X's above a number line indicate the number of straws with the indicated length. There are 2 x's above the 1 inch mark, 3 above the 1 1/4 inch mark, 2 x's above the 1 1/2 inch mark, 2 x'a above the 1 3/4 inch mark, and 2 x's above the 2 inch mark.


Students debug a Scratch Activity. The activity is intended to create a line plot of straw lengths. The straws have been cut into 1, 1 1/4, 1 1/2, 1 3/4, and 2 inch pieces. The length measures are collected in a list called Straw lengths. But the activity has bugs. It does not create an accurate line plot based on the information in the list called Straw lengths. In this example, the line plot has X’s above 1 3/4 and 2. But, if you notice the list, there are not lengths for 1 3/4 and 2 inches included in the list. This activity has a bug.


Programming Skills with Scratch:

  • Open, remix, debug, and share a Scratch Activity
  • Create and use a variable that represents each row of a list
  • Create a list and insert values into a list
  • Repeat an action the same number of times as the number of items in a list
  • Understand how a sprite sends and receives a broadcast
  • Use different Event blocks to start different scripts
  • Drop blocks into a operators block
  • Scratch blocks used: (When green flag clicked, when space bar pressed, when right arrow key pressed, broadcast, when I receive __, clear, stamp, show, hide, move, go to x:_ y:_, point in direction 0, repeat, if __ then, __ = __, row#, list called Straw lengths, change row# by 1, and item row# of Straw lengths)


  1. Open the Length of Straw Pieces Line Plot Scratch activity. Click the green flag. Talk about the list Straw lengths. Ask what the line plot would look like if the items in the list were placed in the correct location on the line plot. (There would be 2 x’s in row 1, 3 x’s in row 1 1/4, and 2 x’s in row 1 1/2.)
  2. Press the space bar. Notice the line plot is incorrect. This activity has a bug. Tell students that they are going to find the bug and fix the activity so that it correctly creates a line plot from a list.
  3. To debug the activity look at each of the scripts carefully.
    • Click the DATA category to open it. Notice a list is already created for this activity called Straw lengths. Also notice that a variable called row# has already been created.
  4. Look at the other scripts.
    1. Click the green flag. Ask what happens when the right arrow key is pressed? Check this script for each of the X sprites. Does it work correctly? (Yes, this is not the problem.) (Do not check the scripts for the cat yet. The cat is only there to help with understanding later in the lesson.)
    2. Click the green flag. Check this script for each of the X sprites. Does it work correctly? (Yes, this is not the problem.)
    3. Next look at the long script that starts when space key is pressed. It has lots of blocks. The cat sprite can help explain these blocks.
    4. Next look at the long script that starts when space key is pressed. It has lots of blocks. The cat sprite can help explain these blocks.
  5. What does the variable row# represent? Go to the cat’s scripts.
    1. Press 1 to start the cat’s first script. The cat shows on the stage.
    2. Press 2 to start the cat’s second script. The cat says, “1”. Why? Change the 1 in this block to another number. What does the cat say? Notice each time the cat says whichever number you select. The variable row# represents a line of the list. In this list there are only 7 lines. So in this activity, this variable should always be set to a number between 1 and 7.
  6. What does the block length of Straw lengths do?
    • Press 3 to start the cat’s third script. The cay says, “7”. Why? (The length of the list is 7. It has 7 lines in the list. If this list had more or less row, the cat would say a different number.)
  7. What does the block say row# of Straw lengths do?
    1. Press 4 to start the cat’s fourth script. The cat says, “1”. Why? (1 is the item or number located in the first row of the list.)
    2. Add change row# by 1 to the bottom of the script. It should look like this. Press 4 again, wait three seconds and press 4 again. Notice the cat says the next item or number in the list.
  8. Now that you understand what these blocks do, look at the big script and go through it one block at a time to see if there is a problem. Pass out the Check Scripts and complete it together.
    • Notice that the first three broadcasts work correctly. However, the 4th and 5th broadcasts are wrong. These all broadcast move 1 1/2. This is the bug in this script. Students have to change the scripts for sprites 1 3/4 and 2 to receive the correct broadcasts.
    • The new scripts should look like these.
  9. Scratch block displaying the correct script structure.

  10. Decide if you want students to work with a partner or individually.
  11. Be sure students know how to delete items from a list and enter items into a list.
    • To delete items use this block.
    • To add items press the + sign in the bottom right corner of the list or press enter on the key board.
  12. Allow time for each student to open, remix, and debug the activity.
  13. Pass out 10—15 pre-cut straws to each student or pair of students. All the straws lengths should be either 1, 1 1/4, 1 1/2, 1 3/4, or 2 inches long.
  14. Ask students to measure their straws and create a line plot using their debugged Scratch activity.
  15. Allow time for students to share and talk about their activity.


  • Ask students to create a line plot for “Math Journal 2, p. 266” shown on p. 730.
  • Ask students to create a new line plot and let other student do the “Mystery Line Plot activity” on “Math Masters p. 291” shown on p.730 with the new line plot.
  • Open the Day of the Week Line Plot Scratch activity
    1. Follow the directions shown on the project page.
    2. Notice this activity allows for user input by using a ask and wait block. It also has a variable called total that keeps a total of the number of inputs added to the list. Ask students to add one or both of these blocks to their debugged activity Length of Straw Pieces Line Plot.


  • Provide a copy of the debugged scripts to students so they can make the changes needed to debug the script.

Common Core:

4.NF.3, 4.NF.3a

CT/CS Standards:

CS-Understand that algorithms are implemented as programs on digital devices, Understand that programs execute by following precise and unambiguous instructions, Write programs that accomplish specific goals
CT-Pattern generalization & abstraction, Decomposition, Pattern recognition, Debugging

Champaign Unit 4 School DistrictKenwood Elementary School: bright stars, bright futures
College of Education at IllinoisUChicago STEM EducationNSF
These lessons were written by Judy Rocke based on lessons developed at Kenwood Elementary School in the Champaign Unit 4 school district. Funding was provided by the National Science Foundation under award number 1542828. These lessons are intended to be used alongside the EM-4 curriculum.

Lessons prepared as web documents in Summer 2017. Contact us for updated lesson plan materials.