# Conditionals with Cards adapted from Code Studio, Course 2

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 adapted from Code Studio, Course 2 Created in Partnership with Revision a

2 Lesson time: approximately 1 hour. LESSON OVERVIEW We don t always know ahead of time what things will be like when we run our computer programs. Different users have different needs, and sometimes you will want to do something based off of one user s need that you don t want to do with someone else. That is where conditionals come in. This lesson demonstrates how conditionals can be used to tailor a program to specific information. TEACHING SUMMARY Getting Started - 15 minutes 1) Prepare 2) Vocabulary Activity: - 30 minutes 3) Wrap-up - 10 minutes 4) Flash Chat - What did we learn? 5) Vocab Shmocab Assessment - 5 minutes 6) Assessment LESSON OBJECTIVES Students will: - Define circumstances when certain parts of programs should run and when they shouldn t - Determine whether a conditional is met based on criteria - Traverse a program and predict the outcome, given a set of input

3 MATERIALS, RESOURCES AND PREP For the Student Playing Cards Paper for keeping track of how a program reacts to a card Pens & Pencils Assessment For the Teacher This Teacher Lesson Guide One Sample Program for the class to look at Print one Assessment for each student GETTING STARTED (15 MIN) 1) Prepare If this is the first time that your class has attempted a programming activity (whether plugged or unplugged) then there are a few things you will need to cover before jumping into the lesson. This example should bring your class up to speed. To begin, your class will need to understand the idea of an algorithm (a list of steps that you can follow to finish a task) as well as loops (the action of doing something over and over again) and eventually conditionals (statements that only run under certain conditions). It is not required that you define each of those terms before you present them with examples. It can be easier to comprehend the definitions if they have had experience with the concepts. Get the classroom s attention. Let them know that you re going to play a game. If I raise my arms, I want you all to stand up. Then, if I put them down, I want you to sit. Ready? Raise your arms and watch the class stand. Put them down and make sure they sit. Run through the combination a couple of times, using whatever order you like. When you re certain that they have it, add some more detail. If I clap when I raise my hands, I want you to clap when you stand., stand quietly.

4 Go through this action a few times to see how the class deals with the If/else aspect. When you re comfortable that they get it, go one step further. Head to the board to write it down so that the class can glance at the directions, in case they forget. 1. Start with the student at the first desk. 2. If student shouts Ready! I give direction., I move to next student. * If I raise my hand, the student shouts their name. *, student shouts my name. Play through the game for a full round, if you have time. When you re done, you will have shown the students what an algorithm is (by listing out the steps of the game), what a loop is (by repeating the steps over and over for each student) and what a conditional is (by doing one thing if you raise your hand, and something else otherwise). You can point to each of those segments when you cover vocabulary. 2) Vocabulary This lesson has three important words: Algorithm - Say it with me: Al-go-ri-thm A list of steps that you can follow to finish a task Conditionals - Say it with me: Con-di-shun-uls Statements that only run under certain conditions Loop - Say it with me: Loop The action of doing something over and over again ACTIVITY: (30 MIN) 3) Directions: 1. Create a few programs with your class that depend on things like a playing card s suit, color, or value to award or subtract points. You can write the program as an algorithm, pseudocode, or actual code.

5 Here is a sample algorithm: This program has you chose a card. If the card is red, your team gets a point., the other team gets a point. 2. Decide how you want to split your class into teams. 3. Each team should have a pile of cards (at least as many cards as team members) nearby. 4. Put one of your Programs up on the board for all to see. 5. Have the teams take turns drawing cards and following the program to see how many points they score in each round. 6. Play several times with several different programs to help the students really understand conditionals. Once the class has had some practice, you can encourage students to nest conditionals inside one another: This program has you choose a card. If the card is red, your team gets a point., the card must be black. If your black card is higher than 9, then the other team gets a point, else your card must be black and lower than or equal to 9, and you get as many points as are on your card.

6 WRAP-UP (10 MIN) 4) Flash Chat: What did we learn? If we don t include loops as part of our algorithm, how many people would get to play? What other things do you do during the day under certain conditions? If you are supposed to do something when the value of a card is more than 5, and you draw a 5, do you meet that condition? Notice that conditions are either True or False. There is no assessment of a condition that evaluates to Banana. When you need to meet several combinations of conditions, we can use something called nested conditionals. - What do you think that means? - Can you give an example of where we saw that during the game? Do you need to put a conditional statement after? Why not? What part of that game did you like the best? LESSON TIP Flash Chat questions are intended to spark big-picture thinking about how the lesson relates to the greater world and the students greater future. Use your knowledge of your classroom to decide if you want to discuss these as a class, in groups, or with an elbow partner. 6) Vocab Shmocab Which one of these definitions did we learn a word for today? - Adding additional space to the beginning of a line of text - A combination of yellow and green - Statements that only run under certain conditions...and what is the word that we learned?

7 ASSESSMENT (5 MIN) 7) Assessment Hand out the assessment worksheet and allow students to complete the activity independently after the instructions have been well explained. This should feel familiar, thanks to the previous activities. EXTENDED LEARNING Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment. True/False Tag Line students up as if to play Red Light / Green Light. Select one person to stand in front as the Caller. The Caller chooses a condition and asks everyone who meets that condition to take a step forward. If you have a red belt, step forward. If you are wearing sandals, take a step forward. Try switching it up by saying things like If you are not blonde, step forward. Nesting 1. Break students up into pairs or small groups. 2. Have them write if statements for playing cards on strips of paper, such as: If the suit is clubs If the color is red 3. Have students create similar strips for outcomes. Add one point Subtract one point 4. Once that s done, have students choose three of each type of strip and three playing cards, paying attention to the order selected. 5. Using three pieces of paper, have students write three different programs using only the sets of strips that they selected, in any order. 6. Encourage students to put some if statements inside other if statements. 7. Now, students should run through all three programs using the cards that they drew, in the same order for each program. Did any two programs return the same answer? Did any return something different?

8 Sample Program - Early Readers Sample algorithm #1 Repeat for each student in group If + 1 Point + 2 Points Sample algorithm #2 Repeat for each student in group If If + 1 Point - 1 Point + 2 Points

9 Sample Program - Beginner Sample program as algorithm If (CARD is RED) Award YOUR team 1 point Award OTHER team 1 point This program has you choose a card. If the card is red, your team gets a point., the other team gets a point. Sample program from above as pseudocode (like code, but in no particular language) If (card.color == RED){ points.yours = points.yours + 1; { points.other = points.other + 1;

10 Sample Program - Intermediate Sample program as algorithm If (CARD is RED) Award YOUR team 1 point If ( CARD is higher than 9) Award YOUR team 1 point Award YOUR team the same number of points on the card This program has you choose a card. If the card is red, your team gets a point., the card must be black. If your black card is higher than 9, then the other team gets a point, else your card must be black and lower than or equal to 9, and you get as many points as are on your card. Sample program from above as pseudocode (like code, but in no particular language) If (card.color == RED) { points.yours = points.yours + 1; { If ( card.value > 9) { points.other = points.other + 1; { points.yours = points.yours + card.value;

11 Unplugged Name: Date: Intermediate Assessment Activity Look at the program below. The steps below show each team taking turns to play the Conditionals Game. See if you can figure out what happens for each draw. Write down the score during each round along the way. After three rounds, circle the winner. If (CARD is lower than 5) If (CARD is BLACK) Award YOUR team the same number of points on the card Award OTHER team 1 point If ( CARD is HEARTS) Award YOUR team 1 point Here s how the game went: ROUND #1 END OF ROUND SCORE TEAM #1 TEAM # END OF ROUND SCORE ROUND #2 4 4 ROUND #3 9 5

### www.eslkidstuff.com Lesson Plans for ESL Kids Teachers

Lesson: General: Time: Objectives: 40 mins - 1 hour Talking about ability, asking Can you? questions and answering with I can. Structures: "Can you..?" "I can " "What can you do?" Target Vocab: jump, run,

### Out of This World Classroom Activity

Out of This World Classroom Activity The Classroom Activity introduces students to the context of a performance task, so they are not disadvantaged in demonstrating the skills the task intends to assess.

### TEACHING ADULTS TO MAKE SENSE OF NUMBER TO SOLVE PROBLEMS USING THE LEARNING PROGRESSIONS

TEACHING ADULTS TO MAKE SENSE OF NUMBER TO SOLVE PROBLEMS USING THE LEARNING PROGRESSIONS Mā te mōhio ka ora: mā te ora ka mōhio Through learning there is life: through life there is learning! The Tertiary

### How to Study Mathematics Written by Paul Dawkins

How to Study Mathematics Written by Paul Dawkins Before I get into the tips for how to study math let me first say that everyone studies differently and there is no one right way to study for a math class.

### Helping Students Develop Their IEPs

TA2, 2nd Edition, January 2002 TECHNICAL ASSISTANCE GUIDE A publication of the National Information Center for Children and Youth with Disabilities Helping Students Develop Their IEPs N IC H CY This guide

### Critical analysis. Be more critical! More analysis needed! That s what my tutors say about my essays. I m not really sure what they mean.

Critical analysis Be more critical! More analysis needed! That s what my tutors say about my essays. I m not really sure what they mean. I thought I had written a really good assignment this time. I did

### www.eslkidstuff.com Lesson Plans for ESL Kids Teachers

You will need: Resources: CD / Tape player cushions (if you have enough floor space) name tags for each student glove puppet (for kids under 7) ball (for kids over 7) resources for whatever you are going

### Core Academic Skills for Educators: Mathematics

The Praxis Study Companion Core Academic Skills for Educators: Mathematics 5732 www.ets.org/praxis Welcome to the Praxis Study Companion Welcome to The Praxis Study Companion Prepare to Show What You Know

### A Self-Directed Guide to Designing Courses for Significant Learning

A Self-Directed Guide to Designing Courses for Significant Learning L. Dee Fink, PhD Director, Instructional Development Program University of Oklahoma Author of: Creating Significant Learning Experiences:

### 3Session. Why Do Children Do What They Do? Positive Solutions for Families. The Center on the Social and Emotional Foundations for Early Learning

Why Do Children Do What They Do? 3Session Positive Solutions for Families The Center on the Social and Emotional Foundations for Early Learning Learner Objectives Suggested Agenda Examine why children

### How Do You Know It? How Can You Show It?

How Do You Know It? How Can You Show It? Penny Reed Wisconsin Assistive Technology Initiative Gayl Bowser Oregon Technology Access Program Jane Korsten Responsive Centers for Psychology and Learning Wisconsin

### WHAT HAPPENS IF MY CHILD IS HAVING TROUBLE LEARNING IN SCHOOL?

TABLE OF CONTENTS INTRODUCTION... 1 WHAT HAPPENS IF MY CHILD IS HAVING TROUBLE LEARNING IN SCHOOL?... 2 STEPS TO GETTING SERVICES... 3 ANSWERS TO FREQUENTLY ASKED QUESTIONS... 9 REQUEST FOR ASSISTANCE...

### GRADE K LITERACY IN SCIENCE: WE ARE EXPERTS

GRADE K LITERACY IN SCIENCE: WE ARE EXPERTS UNIT OVERVIEW This task is embedded in a unit that introduces students to reading and writing informational texts. Students will be encouraged to ask questions

### Figure out the early start and early finish. Early start. Early finish

Figure out the early start and early finish oming up with the float for each activity is useful, but you can actually do better! When you have a long critical path, but the other paths in your network

### If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question

### How to pass your driving. assessment... A Candidate s Guide to the Practical Driving Assessment

How to pass your driving assessment... A Candidate s Guide to the Practical Driving Assessment Prepared and published by Department of Transport, Driver and Vehicle Services. Disclaimer: The information

### Do-it-Yourself Recovery of Unpaid Wages

Do-it-Yourself Recovery of Unpaid Wages How to Represent Yourself Before the California Labor Commissioner A Publication of: The Legal Aid Society-Employment Law Center 600 Harrison Street, Suite 120 San

### NCTM Content Standard/National Science Education Standard

Title: BASE-ic Space Travel Brief Overview: This unit introduces the concepts of bases and exponents (or powers) in order to gain a deeper understanding of place value. Students will assume the role of

### Play It Fair! Play it Fair! Acknowledgement. Index of Reference Sheets. Play it Fair! Human Rights Education Toolkit for Children

Play It Fair! Human Rights Education Toolkit for Children Acknowledgement This program is made possible thanks to the support of: The City of Montreal through its Direction de la diversité sociale; Ministère

### Perfect For RTI. Getting the Most out of. STAR Math. Using data to inform instruction and intervention

Perfect For RTI Getting the Most out of STAR Math Using data to inform instruction and intervention The Accelerated products design, STAR Math, STAR Reading, STAR Early Literacy, Accelerated Math, Accelerated

### Respecting Each Other

LESSON AND ACTIVITY EXCERPTED FROM THE TANENBAUM INTERRELIGIOUS UNDERSTANDING GUIDEBOOK Respecting Each Other Lesson Overview: Students will learn why respect is important while developing their own practical

### Information for candidates For exams from 2015

Ready for success in study, work and life Information for candidates For exams from 2015 First Certificate in English (FCE) www.cambridgeenglish.org/first How to use this guide You can print this document

### Energize Our Families. Parent Program. A Leader s Guide

Energize Our Families Parent Program A Leader s Guide The National Heart, Lung, and Blood Institute (NHLBI) Health Information Center is a service of the NHLBI of the National Institutes of Health. The

### Seeking Supported Employment: What You Need to Know

Self-Determination Series Seeking Supported Employment: What You Need to Know Determine Your Destiny Seeking Supported Employment: What You Need to Know Prepared by: Judith A. Cook, Ph.D. Carol A. Petersen,

### Turning Strategies into Action

Turning Strategies into Action Economic Development Planning Guide for Communities Turning Strategies into Action Table of Contents Introduction 2 Steps to taking action 6 1. Identify a leader to drive

### Game 9. Overview. Materials. Recommended Grades 3 5 Time Instruction: 30 45 minutes Independent Play: 20 30 minutes

Game 9 Cross Out Singles Recommended Grades 3 5 Time Instruction: 30 45 minutes Independent Play: 20 30 minutes Quiet Dice Rolling dice can create lots of noise. To lessen the noise, consider using foam

### Explaining how electric circuits work. Science teaching unit

Explaining how electric circuits work Science teaching unit Disclaimer The Department for Children, Schools and Families wishes to make it clear that the Department and its agents accept no responsibility

### How to Read Like a Writer

How to Read Like a Writer by This essay is a chapter in Writing Spaces: Readings on Writing, Volume 2, a peer-reviewed open textbook series for the writing classroom. Download the full volume and individual