<!--
title: Unit 2 Lab: Control Flow
type: Lab
duration: "01:35"
creator: Susi Remondi
-->

## ![](https://s3.amazonaws.com/python-ga/images/GA_Cog_Medium_White_RGB.png)  {.separator}

<h1>Unit 2 Lab: Control Flow</h1>

<!--

## Overview
This lesson consists of a hands-on lab during which learners will independently create a working Python program. This lab builds on the previous lab, so starter code (which is the same solution code as the previous lab) is provided for them. You simply need to introduce the lab, make sure they have working starter code, make sure they can access the lab doc, and wait in case of questions; at the end, go over the solution (in the solution-code folder).


## Learning Objectives
In this lesson, students will:
- Apply what they've learned in Unit 2 to create a working Python program.


## Duration
1:35 (95 minutes)

## Suggested Agenda

| Time | Activity |
| --- | --- |
| 0:00 - 0:02 | Welcome |
| 0:02 - 1:20 | Work Time |
| 1:20 - 1:35 | Q&A + Close |

## Before Class: Preparation
- Before class, complete the lab yourself to ensure you’re familiar with the solution, as well as the various challenges learners might encounter.
- Change the location of the starter code and lab directions.

## In Class: Materials
- Projector
- Internet connection
- Python 3.0
- Lab directions

-->

---

## Lesson Objectives

- Apply what you’ve learned in Unit 2 to create a working Python program.
- Wrap up Unit 2 (woohoo!).
- Q&A and transition.


<aside class="notes">
**Talking Points**:

- Congratulate them on finishing unit 2!

</aside>

---

## You Do: Unit 2 Lab - Control Flow

Do you remember the first unit lab? You have a print statement to show the user a movie title and rating.

In today's lab, you will use functions, `if` statements, and loops. By the end, your movie app will print a movie title, a movie rating, or both, depending on a string value.

**Open the file [`unit-lab-2-directions`](unit-lab-2-directions.md.html) to see the lab and its instructions. Follow the instructions there.**

- *If your solution to the last lab didn't quite work, there's working code provided in the [`starter-code`](starter-code/movie_app.py) folder. Copy that to your local folder and work from there.*

Try your best! Raise your hand if you really need help.


<aside class="notes">

1 HOUR 18 MINUTES

**Teaching Tips**:

- Make sure you change the link or point out what PDF to look at, and check the starter code location.
- Make sure all students start with working code - they can get it from the starter code file.
- The lab has instructions and an explanation in it for them to read. Make sure they're all opening the lab instructions okay.
- Stay on this slide until everyone's done or time's up!

**Talking Points**:

- Remember, throughout the course, there is a lab at the end of each unit. Each lab builds upon the last.

- Does anyone need help with the starter code?

- Right now, let's set up the functions and control flow to print out the values of our variables.

</aside>

---

## Debrief: Unit 2 Lab - Control Flow

How did it go?

Let's go over it.

Make sure your code works - the Unit 3 lab builds off this one!

<aside class="notes">

**Talking Points**:

- Bring up the solution (in the `solution-code` directory) and walk them through it. Be sure everyone understands - and be sure everyone's code is accurate, because the next lab will build off this one!

</aside>

---

## Unit 2 Wrap Up

What'd we cover?

- Conditionals and Boolean Values
- Lists - `append`, `len`, `pop`, and `insert`.
- Loops - `for` loops, `while` loops, and `range`.
- Functions - including parameters and return statements.
- Function arguments - `*args`, kwargs, and `**kwargs`

Questions?

<aside class="notes">

5 MINUTES

**Teaching Tips**:
- Briefly review the high-level learning objectives for Unit 2.
- As you read each bullet aloud, ask students to give you a "fist to five". See **Talking Points** below.
- Observe student votes for each item, and make a mental note to follow up with individuals who are not feeling confident, or find time to reteach topics that the majority of the class is uncomfortable with.
- Take time to go over questions (but remember the parking lot).

**Talking Points**:
- Wow, we've covered a lot, and we're just getting started! Let's take a minute to review what we've learned so far.
- I'm going to read through the topics for Unit 2. As I do so, I want you to tell me how confident you feel that you've mastered each one, on a scale of 0 to 5.
-- Hold up your fist to indicate 0 - you don't feel confident at all that you mastered this objective.
-- Hold up all five fingers to indicate 5 - you feel super confident. You're an expert!

</aside>
