Students will use a countable then a conditional loop to solve a subtraction problem. They will use a particular problem (involving a dog getting sopping wet in a puddle), solve the number story math problem, and use the result to implement the solution. First, the problem will use a countable loop where the number of repeats (steps) needed for the dog to walk to the puddle is known. They will model their code after this countable loop, add this new code to the existing script, and enter the number of repeats (steps) needed to walk home. Then, they will solve the same problem when the puddle can be placed anywhere. This time, they aren’t able to solve the problem beforehand, and they must using a conditional loop to detect when they are home. They will model their code after the loop that detects when the dog encounters the puddle, and add this new code that uses a conditional sensing loop to detect when the dog has gotten home.
Subtracting fractions less than one with same denominators.
When writing code, computer programmers can choose to have a command repeat a set number of times or until a condition is met (conditional repetition). This activity helps students think about when and why you might use countable or conditional repetition (loops) when subtracting fractions.