Exploring the Scurry of Squirrels in Central Park#

Authors: Anonymized Authors


As computing becomes increasingly intertwined with other disciplines research that centers computing education in an interdisciplinary context (and the challenges surrounding it) is increasingly relevant. In particular, writing modular code (i.e. using functions) is a fundamental part of scientific programming. However, functions have been identified as challenging for students to learn. This assignment leverages a fun, real, and approachable dataset from the 2018 Central Park Squirrel Census as well as experiences authentic to developing scientific programs to introduce the concept of functions in Python. The assignment is intended to be delivered in a “flipped classroom” format, where students are first introduced to concepts in videos and short problems prior to coming to class. Once in class, the students work collaboratively in groups of 4-6 with a hands-on programming activity. By the end of the assignment, students have not only had the opportunity to learn about functions in an authentic context, but they have also been able to make calculations and propose their own problems to learn about the data.


When developing code, you will often be writing code that is meant to fit into a larger project, code that someone else (or future you) may use elsewhere, or code that needs to be used for massive amounts of data. In this assignment, you will practice writing code that others will need to use as well as code that needs to be combined into a larger project. You will also apply your function to a large data set to explore how functions can help when you want to get information form a very large data set. This assignment is guided by the following learning goals:

  • Write and use functions in Python with varying types of input parameters, default parameters, and types of return values

  • Explore the purpose and utility of functions in writing Python code

  • Write and use more complex functions using Boolean logic, loops, and if/else statements

In this assignment, you will work in smaller groups and with your group to write and combine functions to explore data from the 2018 Central Park Squirrel Census. Your end goal is to use your functions from Part 1 to write new functions and extract information from data in Part 2.

During the first part of the assignment, you should not communciate with those in your group who are working on the other function (i.e. the one you’re not working on) once you beging coding. Rather, you should write a function with your small group that your remaing large group members would be able to use without any in depth instruction.

Make sure you write comments, use descriptive variable names, and make sure that your function will work in any notebook!



The purpose of this assignment is to introduce functions in Python with evidence-based pedagogy to improve learning outcomes. The Pre-class assignment is designed to introduce the assignment and allow students to identify places they need support on concepts. The nifty part of this assignment is primarily the In Class assignment. Students begin by writing a function to extract basic information from a small amount of test data and then test it on the whole dataset. They then share their function with the other half of their group and test them to ensure they work on everyone’s computers. After sharing and trouble-shooting functions, the students work together to work on creating a function that calls one of their previous functions to count the number of squirrels with a given fur color. Then, students leverage both of their original functions to write code that will calculate the percentage of squirrels of their chosen fur color observed in the morning (AM) or afternoon (PM) observations. With the remaining time, students are encouraged to explore additional squirrel data and ask their own research questions and then reflect on their experiences from the day.


Functions (also includes if/else, lists, loops, intro data analysis)


Suited for interdisciplinary introductory computing (tested in undergraduates) as well as a more traditional CS1 course


Students with no prior computing experience that are learning functions for the first time find this moderately difficult. One of the functions requires more integration of prior knowledge on lists and loops, and students may need support with the logistics


Roughly 2 hours in an active learning classroom with facilitation


Integrates evidence-based practices both pedagogically and with the specific concept. Allows students to very early experience the authentic process of scientific programming and dealing with (mostly) real data


There is a slight imbalance in the difficulty of the two functions in Part 1. Because our classes are often populated with students from a variety of backgrounds, we sometimes find that students are finished with this part at different times and may have to wait for the other group. One additional caveat is that we did need to introduce a bit of artificial variation in the fur color data to make the problem more difficult to “hard code.”


Students did a pre-class assignment (flipped classroom style) to introduce the basics of functions. The assignment is included for context but is not really what makes this assignment nifty! Students are assumed to have completed the pre-class and been exposed to (but not necessarily confident in): lists, loops, if/else, and some mathematics.


This is an excellent example of weaving authentic practice together with concepts in a course and evidence-based pedagogy. It is an implementation of education research surrounding student problem-solving with functions. Therefore, this assignment is an ideal representation of effective teaching and learning structure.

Teaching Notes#

Assignment Logistics#

  • Read the structure of the assignment carefully because how it is carried out is important for developing student understanding of functions

  • Begin by having students pair off within their groups. Each pair writes one of the two functions described (without discussing it with the other pairs).

  • In Part 2, the students come back together and share their code directly with each other and then test each others’ functions (and see if they work). Then they work together to create an intermediate function to practice calling functions within functions.

  • Then, they plan and write the summary function and use it on the large dataset

  • Finally, they reflect on the experience.


  • It is very important that students have the opportunity to see why function are important: reusable, transferable, and modular. Having to consider how to write their functions so that someone else can use them on their own computer and understand it is an important learning objective.

  • Writing in pairs and then together is a way to help them build individual understanding of functions

  • Planning is also very important here, so make sure students are writing out plans for their codes and testing along the way

  • Be attentive to variable scope (and ask them about it as they work) so that students can consider how Jupyter handles saving variables and what you should/shouldn’t do with functions