Scratch Lab 7

Name: Shreya Raj

Period: 7

Assignment: Lab #7

Lab 7 Overview

This week’s lab was all about blocks. The purpose of the lab was to learn how to create blocks and the to understand the different parameters blocks can obtain. To really understand blocks we had to do a pair programming problem and do two individual problems. After finishing this lab it was evident how useful blocks are to make your code a lot more organized and elegant. Click HERE to get to the lab instructions.

My Solution Problem Number 4

This problem was the area of a rectangle problem. My solution for this problem was to create 3 variables (width, length area), created a block called “area”, and use an existing variable on scratch called “answer”. Then I set my length and width variables to answer and set my area block to width and length. My block “area” had two parameters and I defined the block with the parameters. What I mean by that is for defining the area block, I set my width to the first parameter and the length to the second parameter of the area block. Under defining my area block, I also defined the area variable to an operator which multiplied the two parameters. Then to provide the side length of a square with the same area; I just had programmed my sprite to say the square root of the area variable. Then to provide the side length of an equilateral triangle with the same area; I just programmed my sprite to say the square root of the area divided by 2.

My Project Link

My Solution Problem Number 2

This problem was the feet to inches or miles. My solution for this problem was quite simple. I used the answer variable and a block I created with one parameter to solve this problem. First I had the sprite ask “How many feet?”, then I set the block to the answer. Then the rest of my solution was under the define block. I used a conditional if-then-else statement to solve the problem. The first part of the if-then-else statement stated that if the foot (foot was the parameter) was greater than 5280 then to divide the foot by 5280. Else if the foot was not greater than 5820 then I would have had the sprite multiple the foot by 12 thus converting the feet to inches.

My Project Link


  1. What are two advantages to using blocks for code repetition?
      One advantage for using blocks is that your code gets to be a lot more organized and by being organized it makes your code a lot easier to debug.
  2. What are parameters?
      Parameters in scratch are inputs inside given blocks. The cool thing about parameters are very useful as you can add parameters all throughout your code.
  3. Give an example of a formula that takes at least one parameter.
      An example of a formula that would involve at least one parameter is when you would have to convert feet to inches. You would use the parameter feet and multiply by 12 to get the inches.
  4. Give an example of a situation where no parameters are needed.
      An example where you would not need a parameter if you wanted your sprite to rotate or move when the flag is clicked or when a button is pressed.
  5. Explain what you think the following program does? How do blocks make this easier to understand? Explain what you would expect within each block.
      I think the following program asks for peoples names and then records the names into a list. By using blocks it makes it a lot easier to see each individual step to creating this list. The "get name" block probably takes the users answer. The "insert into list" block processes the answer from the get name block and adds the name to the list. Then the reorder list would probably order the list by alphabetical order and to do this it probably involves many conditonal statements relating to the answer of the user. Finally the "continue" block would probably take the next answer or start the program over again to get the next name.
  6. Click HERE to return to homepage.