In this lab students work in pairs or individually to write seven recursive functions. Without the use of iteration or built-in functions, students must write functions to compute a dot product, return a list of letters in a word, find the index of an element in a sequence, remove elements from a list, filter a list, reverse a list, and find the Scrabble score of a word. This lab requires students to create recursive functions that deal with integers, lists, and strings, as well as to error check. It is particularly useful for students who are new to recursion.
Make the Context even more Meaningful and Relevant by connecting the concept of recursion to the game of Scrabble and including other non-word-oriented games, such as Yahtzee and Rummikub, to the activity. Incorporate Student Choice by adding more functions to the lab and allowing students to choose which set of functions they would like to implement. Additionally, incorporate pair programming so students can switch from being the "driver" to being the "navigator".
This material Employs Meaningful and Relevant Content by integrating the concept of the board game Scrabble into the lab.