Module 6: Creating Efficient Code
This module covers the programming skills that turn one-off scripts into reusable, maintainable workflows. You’ll learn to control program flow with conditions and loops, and to package repeated logic into clean, well-named functions. By the end of Week 6, you’ll be writing code that’s easier to read, test, and extend.
Learning Objectives
By the end of this module, you will:
- Use
if/elif/elsestatements to branch program logic - Write
forandwhileloops to process collections of data - Write functions with arguments, default values, and return statements
- Apply functions to DataFrames using
.apply()and list comprehensions - Identify when to write a function vs. keep code inline
Module Resources
Lecture
| Resource | Link |
|---|---|
| 📊 Week 6 Slides | View slides |
Chapters & Notebooks
| Chapter | Topic | Colab Notebook |
|---|---|---|
| 16 | Control Statements | |
| 17 | Iteration Statements | |
| 18 | Writing Functions |
Lab
This week’s lab is dedicated to project work time. There is no separate lab file — use the Thursday session to make progress on your midterm project with instructor support available.
Reference
| Resource | Link |
|---|---|
| 📋 Module 6 Cheat Sheet | View cheat sheet |