M2: Functions

This module provides an introduction to defining and using functions.

Pre-recorded Lectures

The pre-recorded lectures are available through Canvas.

This module contains a video to introduce the instructor, a series of short (5-15 minute) videos to cover the main topics, and two bonus videos to cover more advanced topics.

  • 2.0 - Meet the instructor

  • 2.1 - Defining and Calling Functions

  • 2.2 - Control Flow for Functions

  • 2.3 - Simple Abstraction Examples

  • 2.4 - Return Statements

  • 2.5 - Passing Parameters using Call-by-Value

  • 2.6 - Scoping

  • 2.7 - Bonus: Optional/Keyword Parameters

  • 2.8 - Bonus: Call Stack

Textbook Chapters

The chapter corresponding to this module is Introduction to Functions.

A PDF version of the textbook is also available here

You will be asked to log in with your CNetID before you can see the textbook.

Please note that the pre-recorded lectures cover largely the same material as the book. We recommend starting with the pre-recorded lectures, and then reading through the book (but do not feel bad if you find yourself skipping large portions of the textbook, if you feel they tread on material that you already understood when watching the lectures)

There are also two additional chapters that we encourage you to read once you’ve watched the videos and read the Introduction to Functions chapter:

Please note that these two chapters do not have any corresponding videos.

Zoom Sessions

You will find the links to the Zoom sessions on Canvas.

  • Week 3
    • Wednesday, October 14th: Lab #2

    • Friday, October 16th: Q&A and PageRank Example

Files from the PageRank example:

Lab

Lab #2: Functions

In the lecture on Oct 14th, we will be working through a few of the problems in this lab. You are not expected to complete the lab before that lecture, but you should try to read through it so you are familiar with its contents.

Short Exercises

Short Exercises #2, due Sunday, Oct 18 at 3pm CDT

Programming Assignment

Programming Assignment #2, due Friday, Oct 23 at 3pm CDT