Unit 2. Developing Programming ToolsRevision Date: Jul 25, 2015 (Version 1.2)
Students must have an understanding of using conditional statements, and have completed all the assignments from Lesson 3-6 (Conditional Execution (Part 1)).
Students will learn how programs can solve problems using nested and chained conditional statements in Python programs.
Students must know that conditional statements can be used inside of other condtional statements using nested and chained conditional statements.
Student computer usage for this lesson is: required
In the Lesson Resources Folder:
In your journal, write what will be displayed by the following code segment. How do you know your answer is correct?
x=2500 if x < 1000: print(“small number”) else: print(“big number”)
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:
if numofBlue > numofIndigoif numofRed > NumofOrange
open red box
open orange box
if numofYellow > NumofGreen
open yellow box
open green box
The Activity Directions
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”)
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:
elif age >= 65:
print("you are a senior citizen")
print("you are an adult")
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.
It is recommended that:
Both 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
Thinking about Nested and Chained Conditional Statements, answer the following questions:
Alternate Instructional Strategy:
Alternate Instructional Strategy: Interactive Journaling
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