⭐ 1.5.4 Division

View

If you are not completely impressed by how fast your puppy can do addition, subtraction, and multiplication, this next example will convince you!  The Scratch division operator is shown here:

 

Activity: Division operator

This activity divides two numbers stored in the variables my Number and myNumber2. Next, the puppy shows the result.  To create the Division Puppy program, follow these steps:

  1. Create a copy of the Multiplication Puppy program by selecting File  File and then Save as a Copy from the top toolbar.
  2. Change the title of the program to Division Puppy and then select File  Save.
  3. Replace the block in the Scripts Area with a  or “() / ()” block.
  4. Click the Green Flag and then set both number variables to 0 by dragging the slider handles all the way to the left.  The puppy starts thinking the characters NaN. This stands for Not a Number. In math, we say that the result of dividing 0 by 0 is “no defined value” because there is no way to find an answer for it.  Scratch simply says that it is not a number.

Figure 28: Puppy saying “Nan”

 

  1. Set the value of the first variable to a number greater than 0 but leave the second number set to 0.  The puppy starts to think the word Infinity, as shown in Figure 29.

 

 NB: When you divide any number by zero, the result is always infinity. For example, if you have a pizza with 12 slices and no one to eat it, how many pieces will each person get and how long will it take to eat? If you have 20 blocks and you want to divide the blocks into groups of 0 blocks, how many groups can you make? There is no answer these questions, and no matter how many groups of blocks you have or how long you say it will take to eat the pizza, a larger number is also possible. So, Scratch and the Division Puppy say that the value is infinity.

  1. Drag the slider for my Number all the way to the left to set it to 0 and drag the slider for myNumber2 to any number other than 0”.  The result is 0”. Can you figure out why?  If you have no pizza, it does not matter how many people you want to give a slice of pizza to—they will all get no pizza.

 

Figure 29: Puppy saying “0”

Figure 31: The Division Puppy program

Last modified: Friday, 24 September 2021, 11:36 AM