Unit4

Unit 4 - Variables, Conditionals, and Functions

Unit Overview

Students expand the types of apps they can create as they learn how to store information (variables), make decisions (conditionals), and better organize code (functions). Each programming topic is covered in a specific sequence of lessons that ask students to ‘Explore’ ideas through hands-on activities, ‘Investigate’ these ideas through guided code reading, ‘Practice’ with sample problems, and apply their understanding as they ‘Make’ a one-day scoped project. The entire unit concludes with a three-day open-ended project in which students must build an app that makes a recommendation about any topic they wish.

Teaching Tip

Modifications for Virtual and Socially-Distanced Classrooms

Are you teaching in a virtual setting or in a socially-distanced classroom? Check out this document for ideas and resources to help you tailor common practices like Think Pair Share or Peer Feedback to your learning environment.

For lesson-specific modifications, check out the Lesson Modifications section within Lesson Plans.

Learn more about how to use these resources here.

Unit Philosophy and Pedagogy

  • Intro to EIPM: This unit is students' first experience with the Explore, Investigate, Practice, Make lesson sequence, or EIPM. This structured approach to teaching programming is covered in detail in the curriculum guide and we highly recommend that you watch the accompanying video series to better understand what EIPM should look like in the classroom. When used effectively, it supports deep learning of content and helps maintain a collaborative classroom culture, even as you move into more complex programming concepts.

  • Scaffolding Towards Independent Projects: A major goal of this course is to empower students to design and build projects independently. The Create PT in Unit 8 offers students enormous freedoms to scope and build projects, and even this unit begins scaffolding towards that goal. Individual EIPM sequences of lessons gradually prepare students for scoped, independent Make projects. The unit project has a few requirements, but students are largely free to choose the design, topic, and implementation of their ideas. As you teach the unit, look for the opportunities to scaffold the skills and knowledge students will need to creatively and independently tackle the unit project.

Major Assessment and Projects

The unit project asks students to design an app that makes a recommendation based on input information frmo the user. Students are given a great deal of freedom to choose their topic, design their user interface, and decide how to actually program their app's behavior. Students submit their app, project guide, and written responses to reflection questions about how the app is designed and the development process they used to make it. Students will also complete an end-of-unit assessment aligned with CS Principles framework objectives covered in this unit.

AP Connections

This unit and unit project helps build towards the enduring understandings listed below. For a detailed mapping of units to Learning Objectives and EKs please see the "Standards" page for this unit.

  • 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.
  • AAP-1: To find specific solutions to generalizable problems, programmers represent and organize data in multiple ways.
  • 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-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 them to write programs more quickly and with more confidence.

This unit includes content from the following topics from the AP CS Principles Framework. For more detailed information on topic coverage in the course review Code.org CSP Topic Coverage.

  • 1.4 Identifying and Correcting Errors
  • 3.1 Variables and Assignment
  • 3.3 Mathematical Expressions
  • 3.5 Boolean Expressions
  • 3.6 Conditionals
  • 3.7 Nested Conditionals
  • 3.15 Random Values

The College Board has supplied formative Create PT questions to help prepare students to complete the Create Task. We recommend that students complete the following prompts with the unit project. More information can be found in Code.org CS Principles Topic Coverage.

  • 3.a.i.
  • 3.a.ii.
  • 3.a.iii

Week 1

Lesson 1: Variables Explore

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (30 mins)
  • Wrap Up (10 mins)

Develop a mental model for how information is stored and processed by programs.

Teacher Links: Presentation | Resource

Lesson 2: Variables Investigate

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Investigate and modify sample apps that use variables and learn common programming patterns with variables.

Teacher Links: Resource | Presentation

Lesson 3: Variables Practice

  • Lesson Modifications
  • Warm Up (0 mins)
  • Activity (40 mins)
  • Wrap Up (5 mins)

Practice programming with variables through a set of programming puzzles.

Teacher Links: Resource | Presentation

Lesson 4: Variables Make

  • Warm Up (2 mins)
  • Activity (38 mins)
  • Wrap Up (5 mins)

Practice making an app that uses variables and programming patterns with variables.

Teacher Links: Presentation Students Links: Activity Guide

Lesson 5: Conditionals Explore

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (30 mins)
  • Wrap Up (10 mins)

Develop a mental model for how computers make decisions.

Teacher Links: Presentation Students Links: Video

Week 2

Lesson 6: Conditionals Investigate

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Investigate and modify sample apps that use conditionals and learn common programming patterns with conditionals.

Teacher Links: Presentation

Lesson 7: Conditionals Practice

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Practice programming with conditionals through a set of programming puzzles.

Teacher Links: Presentation |

Lesson 8: Conditionals Make

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (38 mins)
  • Wrap Up (5 mins)

Practice making an app that uses conditionals and programming patterns with conditionals.

Teacher Links: Presentation Students Links: Activity Guide

Lesson 9: Functions Explore / Investigate

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (30 mins)
  • Wrap Up (10 mins)

Develop a mental model for using functions to replace repeated code. Investigate and modify sample apps that use functions.

Teacher Links: Presentation Students Links: Activity Guide

Lesson 10: Functions Practice

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (35 mins)
  • Wrap Up (5 mins)

Practice programming with functions through a set of programming puzzles.

Teacher Links: Presentation

Week 3

Lesson 11: Functions Make

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (38 mins)
  • Wrap Up (5 mins)

Practice making an app that uses functions and programming patterns with functions.

Teacher Links: Presentation Students Links: Activity Guide

Lesson 12: Project - Decision Maker App Part 1

  • Lesson Modifications
  • Warm Up (5 mins)
  • Activity (40 mins)
  • Wrap Up (0 mins)

Create an app from scratch that uses variables, conditionals, and functions to help a user make a decision.

Teacher Links: Presentation Students Links: Rubric | Planning Guide

Lesson 13: Project - Decision Maker App Part 2

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (38 mins)
  • Wrap Up (5 mins)

Create an app from scratch that uses variables, conditionals, and functions to help a user make a decision.

Teacher Links: Presentation Students Links: Planning Guide | Rubric

Lesson 14: Project - Decision Maker App Part 3

  • Lesson Modifications
  • Warm Up (2 mins)
  • Activity (38 mins)
  • Wrap Up (10 mins)

Create an app from scratch that uses variables, conditionals, and functions to help a user make a decision.

Teacher Links: Presentation Students Links: Planning Guide | Rubric

Lesson 15: Assessment Day

  • Lesson Modifications
  • Assessment (25 mins)
  • Assessment Review (20 mins)

Assessment day to conclude the unit.