|
Computer Science Home
6th Grade Tech Ed
7th Grade Computer Science
8th Grade Computer Science A
Gmail
Google Drive
Google Classroom
Infinite Campus
Typing.com
(Join Class through Google Classroom)
Schoology
Code.org
Tynker Coding Website
Tynker Resource Page
Tynker Online Support Video Help
Quizlet | Quizlet LIVE
Everfi
Khan Academy
Social Media Tips
Netsmartz
Code HS
Karel the Dog class code: 1251
CSTA Standards
ISTE Standards
|
In this lesson, students will learn how to make a program react to different inputs using conditional statements, logic expressions, and operators.
New Code Blocks
- : If the condition is true, then run the code inside the block.
- : This is a comparison operator that returns true if the first value is greater than the second value, and returns false otherwise.
- : This is a comparison operator that returns true if the first value is equal to the second value, and returns false otherwise.
- : Pause the given script until the condition in the parameter is equivalent to true.
Vocabulary
- Condition: A logical expression that evaluates to true or false
- Conditional statement: A type of statement that executes different parts of the code based on whether a logical expression evaluates to true or false
Objectives
Students will...
- Apply conditional statements to coding projects
- Create an Actor who makes different comments and changes costumes depending on the scene
Notes:
- As a class, discuss strategies that your students can use as tools when they encounter an obstacle or unexpected outcome while coding. (Brainstorm potential solutions with a neighbor, take a short 1 minute break to look away from the screen, breaking down problems into smaller components)
1. A Rainy Day (Video)
- Students will watch a short video where Professor Ada introduces “conditional statements” and gives some familiar examples from weather.
2. Operators and Conditions (Video)
- This module introduces three coding concepts:
- “If-Then” block- If a condition is true, then run the code inside this block.
- Comparison operators- Some of the most commonly used comparison operators include: equals (=), greater than (>), and less than (<). Students may need a reminder about the meaning of the “>” and “<” mathematical symbols.
- "Wait until" block- This is an event block that continually checks until something happens, then it runs its code block.
3. The Marching Elephant Example (Example)
- Students will view a project of an elephant that reappears after it walks off the Stage.
4. The Marching Elephant (DIY)
- In this DIY project, students will create a loop that animates the elephant’s motion and moves it back on the Stage once it reaches the edge.
- This project requires students to use an “if” statement combined with a boolean “greater than” expression.
- Did students point out that we could’ve used the “if on edge, bounce” block with the elephant? Explain that they’re correct, but we’re just using this example to show how the “if-then” code block works.
- Did students finish early? Encourage them to experiment with their code to make the elephant’s march faster or slower.
5. Changing Scenes Example (Example)
- Students will view an example of a scene-switching project.
- Check that students are clicking (for web) or tapping (for mobile) on the Stage to change the scene.
6. Changing Scenes (DIY)
- In this DIY project, students will program a slideshow that displays new scenes when they click (for web) or tap (for mobile) on the screen!
- By using a conditional statement, the first scene is only shown once.
- This project introduces the “equal to” block, which students will need to drag into the “if-then” block.
7. Keep the Knight Talking Example (Example)
- In this module, students will view a project where a knight reacts to the scene.
- Tell students to click (for web) or tap (for mobile) the knight to see his reaction!
8. Keep the Knight Talking (DIY)
- In this DIY project, students will add on to their previous program, and have the knight say new things when he finds himself in a new scene!
- Students may not realize that they need to add the Jungle scene to the Stage Actor. In case they don’t recall how to do this, on web, double click on the Stage, click on “Settings;” choose “Add Background.” On mobile, tap on the three dots by the Stage, select “Properties,” and tap or choose “Add Background.”
- Students will need to type the name of their new background into the second spot after the “=” symbol. Additionally, students will need to type a message inside the “say” block.
9. Color Codey (Puzzle)
- To solve this puzzle module, students will need to use four different “if-then” blocks to switch Codey to the appropriate color, depending on which color jelly bean he touches.
- Give a hint: Tell students to place four different “if-then” blocks inside one “forever” block.
10. The Magic Potion Example (Example)
- In this module, students will view an example of a project where the Actor changes its costumes randomly, then says something!
11. The Magic Potion (DIY)
- In this DIY project, students are asked to add a new Actor and at least four different costumes. Additionally, students will need to code their Actor to change into a random costume when it is clicked or tapped on.
- Did students forget how to add a costume? Tell them to select an Actor; go to the “Settings” for the Actor; then add new costumes.
12. Quiz (Multiple-Choice)
U.S. Standards
- K-12 CTSA Computer Science Standards (Revised 2017)
Computer Science Teachers Association:
- 1B-AP-10
- 1B-AP-11
- 1B-AP-12
- 1B-AP-15
- 2-AP-12
- 2-AP-13
- 2-AP-15
- 2-AP-16
- 2-AP-17
- CCSS-Math: 2.OA.B.2, 3.NBT.A.2, 4.NBT.A.2, MP.1, MP.2, MP.4
- CCSS-ELA: RF.1.1, RF.2.4, RF.2.4.A, RF.3.4.A, RF.4.4.A, RI.2.6
- CS CA:K-2.AP.12, K-2.AP.13, K-2.AP.16, 3-5.AP.13, 3-5.AP.14, 3-5.AP.17
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 7.c
|