5.7 & 5.8 Loops Practice & Make
Assigned: Nov 4 (A-day) Nov 7 (B-day)
Due: Nov 7 (A-day), Nov 8 (B-day
Assigned: Nov 4 (A-day) Nov 7 (B-day)
Due: Nov 7 (A-day), Nov 8 (B-day
Warm Up (5 minutes)
Activity (30 minutes)
Wrap Up (10 minutes)
MAKE Planning Guide and Rubric - this will be graded.
Iteration: a repetitive portion of an algorithm that repeats a specified number of times or until a given condition is met.
Infinite loop: occurs when the ending condition will never evaluate to true. In other words, the Boolean expression will never evaluate to false.
For Loop: Uses a boolean condition to repeatedly run a block of code. If it is true it runs the block of code contained within it. This process of checking the condition and running the block of code is repeated as long as the Boolean condition remains true. Once the Boolean expression becomes false it will stop.
for(var i=0; i<3; i++){
… do something
}
While Loop: Condenses the parts of a while loop into a shorter statement. Similar to the while loop, once the Boolean expression becomes false, the loop ends.
var count = 0;
while(count < 3){
… do something
count++;
}
&&^^**^^&& Follow up code: You are responsible for knowing WHY it works, not just THAT it works
You can also view the video here BUT you must comment on all lines so that you describe what is happening with the code and why. This will help you prepare yourself when you have a test. If you only follow what you see, you will not truly learn the process. Don't be a follower, be a learner in progress: https://www.youtube.com/watch?v=B-yYUaC5GxE
Students practice the basics of loops including using while loops, for loops, and updating multiple screen elements with a for loop. Along the way students develop debugging practices with loops.
Using Programming Patterns and a step-by-step approach students make their own version of a Lock Screen Maker app. At the beginning of the lesson students are able to explore a working version of the app. They are then given the design elements of the app but begin with minimal starting code. A progression of levels guides students on the high level steps they should use to develop their app but leaves it to them to decide how to write the code. At the end students submit their apps which can be assessed using a provided rubric.
This lesson is students primary opportunity to get hands on with loops in code prior to the Make activity in the following lesson. Give students as much class time as you can to work through these. For this lesson it's recommended that you place students in pairs as a support and to encourage discussion about the challenges or concepts they're seeing.
This lesson is students primary opportunity to get hands on with loops in code prior to the Make activity in the following lesson. Give students as much class time as you can to work through these. For this lesson it's recommended that you place students in pairs as a support and to encourage discussion about the challenges or concepts they're seeing.
CSP Conceptual Framework
AAP-2 - The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values.
AAP-2.K - For iteration: a. Represent using iteration statements. b. Determine the result or side-effect of iteration statements.
AAP-2.K.2 - The exam reference sheet providesREPEAT n TIMES{ <block of statements>}in which the block of statements is executed n times.
AAP-2.K.3 - The exam reference sheet providesREPEAT UNTIL(condition){ <block of statements>}in which the code in block of statements is repeated until the Boolean expression condition evaluates to true.
AAP-2.K.4 - In REPEAT UNTIL(condition) iteration, an infinite loop occurs when the ending condition will never evaluate to true.
AAP-2.K.5 - In REPEAT UNTIL(condition) iteration, if the conditional evaluates to true initially, the loop body is not executed at all, due to the condition being checked before the loop.
AAP-2.L - Compare multiple algorithms to determine if they yield the same side effect or result.
AAP-2.L.1 - Algorithms can be written in different ways and still accomplish the same tasks.
AAP-2.L.2 - Algorithms that appear similar can yield different side effects or results.
AAP-2.L.5 - Different algorithms can be developed or used to solve the same problem.
CRD-2 - Developers create and innovate using an iterative design process that is user-focused, that incorporates implementation/feedback cycles, and that leaves ample room for experimentation and risk-taking.
CRD-2.I - For errors in an algorithm or program: a. Identify the error. b. Correct the error.
CRD-2.I.3 - A run-time error is a mistake in the program that occurs during the execution of a program. Programming languages define their own run-time errors.
CRD-2.I.4 - An overflow error is an error that occurs when a computer attempts to handle a number that is outside of the defined range of values.
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
3A-AP-15 - Justify the selection of specific control structures when tradeoffs involve implementation, readability, and program performance and explain the benefits and drawbacks of choices made.
DA - Data & Analysis
3A-DA-12 - Create computational models that represent the relationships among different elements of data collected from a phenomenon or process.