Lesson Summary

Pre-lesson preparation

Students must have an understanding of using conditional statements, and have completed all the assignments from Lesson 2-8.


Students will learn how programs can solve problems using nested and chained conditional statements in Python programs.


  • Students will understand how nested and chained conditional logic controls program flow.
  • Students will be able to solve problems that require nested and chained conditional logic.
  • Students will work collaboratively, resolve conflicts and facilitate group work to create a small program.
  • Students will use their journals to record answers and check for understanding and reflection.


  1. Getting Started (5 min)
  2. Introduction of Content (30 min)
    1. Conditional Statements [10 min]
    2. Nested Conditional Statements [15 min]
    3. Chained Conditional Statements [5 min]
  3. Activity (10 min)
  4. Wrap-up (5 min) 

Learning Objectives

CSP Objectives

Big Idea - Creativity
  • EU 1.2 - Computing enables people to use creative development processes to create computational artifacts for creative expression or to solve a problem.
    • LO 1.2.1 - Create a computational artifact for creative expression. [P2]
      • EK 1.2.1B - Creating computational artifacts requires understanding of and use of software tools and services.
    • LO 1.2.2 - Create a computational artifact using computing tools and techniques to solve a problem. [P2]
      • EK 1.2.2A - Computing tools and techniques can enhance the process of finding a solution to a problem.
    • LO 1.2.4 - Collaborate in the creation of computational artifacts. [P6]
      • EK 1.2.4A - A collaboratively created computational artifact reflects effort by more than one person.
      • EK 1.2.4C - Effective collaborative teams practice interpersonal communication, consensus building, conflict resolution, and negotiation.
      • EK 1.2.4D - Effective collaboration strategies enhance performance.
Big Idea - Algorithms
  • EU 4.1 - Algorithms are precise sequences of instructions for processes that can be executed by a computer and are implemented using programming languages.
    • LO 4.1.1 - Develop an algorithm for implementation in a program. [P2]
Big Idea - Programming
  • EU 5.1 - Programs can be developed for creative expression, to satisfy personal curiosity, to create new knowledge, or to solve problems (to help people, organizations, or society).
    • LO 5.1.2 - Develop a correct program to solve problems. [P2]
      • EK 5.1.2C - Incrementally adding tested program segments to correct working programs helps create large correct programs.
      • EK 5.1.2I - A programmer's knowledge and skill affects how a program is developed and how it is used to solve a problem.
      • EK 5.1.2J - A programmer designs, implements, tests, debugs, and maintains programs when solving problems.
    • LO 5.1.3 - Collaborate to develop a program. [P6]
  • EU 5.2 - People write programs to execute algorithms.
    • LO 5.2.1 - Explain how programs implement algorithms. [P3]
      • EK 5.2.1A - Algorithms are implemented using program instructions that are processed during program execution.
      • EK 5.2.1B - Program instructions are executed sequentially.
      • EK 5.2.1C - Program instructions may involve variables that are initialized and updated, read, and written.
      • EK 5.2.1D - An understanding of instruction processing and program execution is useful for programming.
      • EK 5.2.1E - Program execution automates processes.
  • EU 5.4 - Programs are developed, maintained, and used by people for different purposes.
    • LO 5.4.1 - Evaluate the correctness of a program. [P4]
      • EK 5.4.1A - Program style can affect the determination of program correctness.
      • EK 5.4.1C - Meaningful names for variables and procedures help people better understand programs.
  • EU 5.5 - Programming uses mathematical and logical concepts.
    • LO 5.5.1 - Employ appropriate mathematical and logical concepts in programming. [P1]
      • EK 5.5.1A - Numbers and numerical concepts are fundamental to programming.
      • EK 5.5.1D - Mathematical expressions using arithmetic operators are part of most programming languages.
      • EK 5.5.1E - Logical concepts and Boolean algebra are fundamental to programming.
      • EK 5.5.1G - Intuitive and formal reasoning about program components using Boolean concepts helps in developing correct programs.

Math Common Core Practice:

  • MP1: Make sense of problems and persevere in solving them.
  • MP2: Reason abstractly and quantitatively.
  • MP5: Use appropriate tools strategically.
  • MP6: Attend to precision.
  • MP7: Look for and make use of structure.

Common Core ELA:

  • WHST 12.2 - Write informative/explanatory texts, including the narration of historical events, scientific procedures/experiments, or technical processes
  • WHST 12.9 - Draw evidence from informational texts to support analysis, reflection, and research

NGSS Practices:

  • 1. Asking questions (for science) and defining problems (for engineering)
  • 3. Planning and carrying out investigations
  • 4. Analyzing and interpreting data
  • 5. Using mathematics and computational thinking
  • 8. Obtaining, evaluation, and communicating information

Key Concepts

Students must know that conditional statements can be used inside of other condtional statements using nested and chained conditional statements.


  • nested conditional statements
  • chained conditional statements

Essential Questions

  • How are programs developed to help people, organizations or society solve problems?
  • How do computer programs implement algorithms?
  • How do people develop and test computer programs?
  • Which mathematical and logical concepts are fundamental to computer programming?

Teacher Resources

Student computer usage for this lesson is: required

In the Lesson Resources Folder:

  • Nested If Statement Setup

Reference Text:

Project Ideas:

Lesson Plan

Getting Started (5 min)

In your journal, write what will be displayed by the following code segment.  How do you know your answer is correct?

if x < 1000:
   print(“small number”)
   print(“big number”)


Introduction of Content (30 min)

Brief introduction to conditional statements (10 min)

Suggested Activity: What’s in the box? (Part 2)

Show physical representation using real life example by revisiting the box example from previous lesson:

Materials: Four small opaque containers, four small items, two opaque containers big enough to fit two small opaque containers, Six post it notes to label each container with a color

Set Up Directions: Set up the activity before the class arrives following the directions below:

  1. Place one small item in each small container
  2. With the post-it notes, label the four small containers with different color names (red, orange, yellow, green)
  3. Place two labeled containers in each of the larger containers
  4. With the remaining post it notes, label one box blue and the other indigo.
  5. On the board, write the color names on the board to record the student tally.
  6. On the board, write the following pseudocode:
if numofBlue > numofIndigo
if numofRed > NumofOrange
open red box
open orange box
if numofYellow > NumofGreen
open yellow box
open green box

The Activity Directions

  1. Ask: “If you could choose one of these colors, which one would it be. Please only vote once.  Raise your hand if you would choose Blue. Record the number of students who voted for Blue on the board.
  2. Ask: “Raise your hand if you would choose Indigo.” Record the number of students who voted for Indigo on the board.
  3. Show the students the pseudocode on the board and work through the if/else statement using the the data collected from the class.
  4. Open the the box and display the contents of the box  the class voted for.
  5. Have students repeat the voting procedure to choose which smaller box to choose and show the object they chose

Brief discussion on nested conditional statements (15 min)

Demonstrate the coding process of the example below. 

Guided Activity 1 - Coding Example:  Write a program that evaluates a variable "age" and displays a group age category (you are not an adult, you are a senior citizen or you are an adult.)Suggested Instructional Strategy - Think Aloud - model your thought process for solving this problem.  Include comments in your code.

age = 18
if age < 18:
  print(“you are not an adult”)
  if age is > 65:
      print(“you are a senior citizen”)
      print(“you are an adult”)

Brief discussion on chained conditional statements (elif) (5 min)

Guided Activity 2 - Coding Example:

Write a program that prompts the user for their age and displays their age category ( you are not an adult, you are a senior citizen or you are an adult.)  If they are older than 200 display a message that reads "humanly impossible".

age = int(input("How old are you"))
if age < 18:
  print("you are not an adult")
elif age > 200:
  print("humanly impossible")
elif age >= 65:
  print("you are a senior citizen")
  print("you are an adult")

Check for understanding

Assign students random numbers from 0 - 250.  Have students decide what group they belong to (child, adult, senior citizen, not human) and explain why they made their choice.  *** You could have students physically move into the groups, hold up a sign with their answer or answer quietly in their journal.  

Activity (10 min)

Collaborative Coding (10 minutes)

  1. Review group work requirements: all members contribute, resolve conflicts internally before asking the teacher for help, facilitate the contribution of all team members. Work together to decide how to divide up the work so that all group members contribute significantly to the process. Suggested roles: driver/navigator, timer, tester, journalist (recorder).
  2. In your group, develop the pseudocode for the following problem:
        A year is a leap year if it is divisible by 4 unless it is a century that is not divisible by 400. Write a function that takes a year as a parameter and returns True if the year is a leap year, False otherwise.
  3. In your group, write the program for the problem.  


It is recommended that:

All partners should be actively involved in the program development. For example, you may choose to employ Pair Programming, in which one partner “drives” (types and uses the mouse) while the other “navigates” (reviews and helps to guide what the driver is doing), with the partners changing roles every 20 minutes. Another method of collaboration is for each partner to develop pieces of the program, combine those pieces, and provide frequent feedback to each other during the development process.

-The College Board Computer Science Principles, Performance Assessment ©2014


Wrap Up (5 min)


Thinking about Nested and Chained Conditional Statements, answer the following questions:

  1. What difficulties, if any did you encounter during development of your program?
  2. What difficulties, if any, did you encounter with your partner.
  3. If any difficulties did arise, what do you think are some strategies to eliminate the difficulties
  4. What concepts in this lesson do you need clarified?

Options for Differentiated Instruction



  • Extension can be assigned as Homework

Alternate Instructional Strategy:

  • For guided practice, have a list of list of instructions for how to write the example presented
  • Think Aloud - Model your thought process while solving the guided practice problems

Alternate Instructional Strategy: Interactive Journaling

  • Comment on the journal entry by asking check for understanding questions or clarifying any misconceptions students write about.

Evidence of Learning

Formative Assessment

  • A variety of checking for understanding techniques
    • Temperature checks
    • Teacher review student's code
    • Thumbs up/ thumbs down
    • Questioning throughout the lesson (whole group / small group / individual)
  • Quick quizzes
  • Peer review
  • Interactive journaling

Summative Assessment

Students will create a collaborative program demonstrating concepts introduced in this two part lesson. Students will be assessed using a rubric and will reflect on their learning in their journal