Lesson 4.7 & 4.8 Conditionals practice and MAKE
Sept 27(A-day) and Sept 28(B-day)
Sept 27(A-day) and Sept 28(B-day)
Code.org Assignment
Bubbles 1-3 use only the console.log() command
Bubbles 1 and 2 will use comparison operators
Bubble 3 will use a Boolean expression
Bubbles 4-8 will be using IF-Statements
Bubbles 9-10 will use the flow chart for "Can I adopt a cat?"
NEW BLOCK include getNumber()
Bubble 11 use of a MOD operator
Wrap Up Check your understanding
U4L8 Conditionals MAKE - Student App Guide
In your code, remember to describe the intent of any block of code in your comments. What is the block doing for your app?
when: means there is an onEvent to respond to user input. The app does something "when" the user clicks.
if: means there is a conditional statement that decides what pieces of code to run. The app does something "if" a boolean expression evaluates to true.
mode operator %: takes two numbers, processes them, and returns a value. EASY WAY TO UNDERSTAND - when dividing the numbers, the mod is the remaining number
Example: 5 mod 3 evaluates to 2
5 % 3 evalutates to 2
In this lesson students spend most of their time practicing using the skills and processes they have learned about conditionals. At the conclusion of the lesson students discuss the main things they realized and still have questions about at the conclusion of this lesson.
This lesson is students primary opportunity to get hands on with conditionals 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. In the following lesson students are encouraged to work independently.
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.E - For relationships between two variables, expressions, or values: a. Represent using relational operators b. Evaluate expressions that use relational operators.
AAP-2.F - For relationships between Boolean values: a. Represent using logical operators. b. Evaluate expressions that use logic operators.
AAP-2.H - For selection: a. Represent using conditional statements. b. Determine the result of conditional statements.
AAP-2.L - Compare multiple algorithms to determine if they yield the same side effect or result.
AAP-3 - Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing programmers to write programs more quickly and with more confidence.
AAP-3.A - For procedure calls: a. Write statements to call procedures. b. Determine the result or effect of a procedure call.
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.J - Identify inputs and corresponding expected output or behaviors that can be used to check the correctness of an algorithm or program.
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
2-AP-10 - Use flowcharts and/or pseudocode to address complex problems as algorithms.
2-AP-12 - Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.