DAY 8 - Coding and Computer Science for Kids 1
Category: Coding & Computer Science 1
Date: June 20, 2018
Coding and Computer Science for Kids 1 - DAY 8
♦Please take this survey first today to tell us your last day of Summer School 2018. (Take this survey only one time!)

♦Check out Kano coding resources.


On your last day (or before), using no notes:

1) Take the Computer Science POST-TEST.

2) Take the Coding POST-TEST.


♦OPTIONAL: Play Quizlet Live with our class.
1) Take the Matching QUIZLET Coding Test and submit current score in Edmodo.
2) Take the Matching QUIZLET Computer Science Test and submit current score in Edmodo.
♦Based on your current score, STUDY Coding and Computer Science vocabulary terms in Quizlet to prepare for two class FINAL ASSESSMENTS. CONDITIONALS (Coding with Cards):

Lesson Overview:


Students explore conditionals, especially as they pertain to loops and if-statements as they play a class game. After introducing the idea of conditionals, if-statements, and loops, the class can practice together using a pre-written program, a deck of cards, and luck of the draw.


Essential Question:
What are conditionals, and how do they help us to write effective programs?

• I can gain experience determining the outcome (true or false) of conditionals.

I can evaluate logical statements to determine which branch of a program to follow.


Algorithm — (n.) A list of steps to finish a task. A set of instructions that can be performed with or without a computer.

Conditional — (n.) A statement that is either true or false depending on the situation.

Decrement — (n.) To subtract a certain amount (often 1), once or many times

Else — (n.) Another way of saying “Otherwise”

Function — (n.) A piece of code that can be called over and over

If Statement — (n.) A line that determines whether or not you run a certain chunk of code.

Increment — (n.) To add a certain amount (often 1), once or many times

Loop — (n.) The action of doing something over and over again.

Nested Statements — (n.) A statement inside another statement




Think back to our last sun-catcher functions lesson.


Class Participation Questions:

• What did we do in our last lesson with the sun-catchers?

• What are functions, and how did we use them in the sun-catchers lesson?

• How is a while block different from an if block?


Partner Discussion:

• Can you think of anything we do in real life that could be described with a while loop?


Lesson Steps:

Today we will be playing a card game and in the process, learn about conditionals and if-statements.


To begin, let’s review conditionals, which you have already seen in the online Blockly activities.


It can be helpful to start with some real-life inspirational examples:


“If you all raise your hand, I will clap. Otherwise, I will touch my nose.”



“What just happened there?”

“I gave you a ‘condition’ right? I said, that under one condition I would do one thing, but if that condition wasn’t met, I would do something else. Conditionals are the way computers make decisions.”


Let’s try another one, adding the “Else” terminology.


If you all put your hands on your desks, I will scratch my head. Else, I will put my hand on my hip.”


This is similar enough to the first case that you should be able to infer what the “else” is saying, but if you have trouble, remember that “else” is very similar to the word “otherwise.”


“Good job. Now let’s make this a little more interesting. I have a stack of playing cards here. We’re going to play a game.


If I draw a red card, I get a point.


Else, you get a point.”


Let’s look at this simple statement and point to each case as it happens.


We will draw a few cards from the top of the pile, and add points appropriately. When the card is red, show them which case you look at (the top one) and when it’s black, point out that it matches the “Else” case.


After a few rounds, we are now ready to step it up a notch.


“Okay, we’re going to use this idea of conditions, or ‘Conditionals’ to play a game. We call these ‘If Statements’ conditionals, because there is a ‘condition’ placed on them. Something is either true, or it’s not. If it’s true, we do the instruction inside the ‘If Statement’. Otherwise, we do the instruction inside of the ‘Else’.”


We are now going to play a game. The game will last 4 turns on each side. The class will be split into “Left Side” and “Right Side.” They will compete to see who gets the most points.


Just so we’re all clear about the rules, let’s look at them carefully below.


1) if (card.color == black) {

2) team.points += 1;

3) }

4) else {

5) team.points -=1;

6) }


The code represented above is how conditionals are written in JavaScript, the world’s most widely adopted programming language.


In the online activities in this course, we’ve been writing code with Blockly, which uses visual blocks to represent code. The code we’ve been writing in those activities can also be represented in other programming languages. For instance, in our online activities, if you click “Show Code” in the purple header, you can see the blocks on your workspace represented in Javascript.


Again, below is code for the activity we’ll be doing today:


1) if (card.color == black) {

2) team.points += 1;

3) }

4) else {

5) team.points -=1;

6) }


Let’s review this format line by line, since it will probably be a new sight to most of us.


1) This line is your “If Statement.” This is the line that lets you know that “If the color of the card is equal to black, you do THIS.” Notice how there are two equal signs? In many programming languages, this is how we say that we’re checking for equality, not assigning something to be equal to. This line ends with an “opening curly brace.” That’s there to let us know that the next line belongs to the “If Statement”.


2) This line literally says, “Points plus equals one”. It means that you take whatever number of points that you had, and add one to it. Whatever that equals is your new points value.


3) This is a “closing curly brace.” It is there to tell you that the “If Statement” has ended.


4) Here is the start of the “Else” statement. At the end of this line, you’ll see another opening brace. That means that this is the beginning of the piece that we do if we don’t match the “If Statement.”


5) This is very similar to line 2 but with one difference. Can anyone spot what it is? What do you suppose it does? (It means that you take whatever number of points that you had, and subtract one from it. Whatever that equals is your new points value.)


6) Finally, in line 7, we have the last “closing curly brace.” It tells us that the “Else Statement” is done.


Here’s the JavaScript written next to the same code represented in pseudocode, which is informally-written code that’s easy for people to read. Each line of pseudocode explains what that line of JavaScript is doing.


After our review of each line, it’s good to take a step back and look at the big picture.


  • What does this actually mean?
  • Can we put it into actual words?
  • Essentially it says that if a person draws a black card, the team gets a point. Otherwise, the team loses a point.
  • Should we get started?


We will pick volunteers from each team to be the “programmers.”


Each of the programmers will draw a face card. (This isn’t required, but it’s a fun way to choose which team goes first.)


As assigned, programmers will pick a student with a numbered card. That student will hold up his or her card.


  • What color is it?
  • What line does it match to?
  • What does that do to your team’s points?


Move to a programmer from the opposite team, and repeat until all programmers have had a turn.


  • What are the final points?
  • Which team is the winner?


If the game goes quickly enough, we will choose another program and start again. If it goes *really* well, we will challenge our class to modify the program to provide more options.


CHALLENGE: When we’ve played it through a couple of times, let’s try explaining and adding other features, like “While Loops,” or “Nested Statements.”


♦Check your Accelerated Intro to CS Course Progress so far in your account:

The circles will turn green when they are completed correctly.


The Artist 3 Activity


♦ In these puzzles, you are a zombie artist who loves drawing. Help him to draw designs and shapes using special colors using all the same blocks arranged in categories: Actions: Move Forward, Turn, Draw; Color: Set Color; Loops: Repeat; and Math: change value.

Additional Learning Tasks:

1) Log in to Edmodo and check notifications for our Coding and Computer Science group. Check your Profile for Edmodo badges earned so far.
2) Log in to your account and work in your Accelerated Intro to CS Course activities.
3) Explore and study vocabulary words and definitions using the following Quizlet sets:
(Optional: Join our Coding and Computer Science class by clicking here.)
(Study Flashcards and play Match game.)
[We will also play Quizlet Live at school.]
(Study Flashcards and play Match game.)
[We will also play Quizlet Live at school.]
4) Check out additional coding apps and resources using your own devices at home.

  Curriculum Attribution: All Accelerated Intro to CS Course lessons are adapted directly from, an exemplary non-profit organization committed to educating and empowering students, teachers, and parents with essential coding and computer science technology skills.
<print>            <close window>