Skip to main content

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/else statements to branch program logic
  • Write for and while loops 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
💻 Tuesday Your Turn Notebook Open in Colab

Chapters & Notebooks

Chapter Topic Colab Notebook
16 Control Statements Open in Colab
17 Iteration Statements Open in Colab
18 Writing Functions Open in Colab

Reference

Resource Link
📋 Module 6 Cheat Sheet View cheat sheet

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 semester project with instructor support available.