Making Change

In this assignment students work either individually or in pairs to write a function that generates the shortest possible list of change for a given target and list of coin values. Using recursion, students must first find the minimum number of coins required to create a value and then modify this function to return the actual coin values used. This assignment requires students to use recursion with lists. It is particularly useful for students who need additional practice with recursion.

Scrabble Scoring

In this assignment, students write a function that finds the highest scoring word that can be formed from a list of letters, as in the game Scrabble. Students must use recursion, list comprehension, and lambda functions to find all the possible words that can be formed from the given list of letters. In addition to reviewing recursion and lists, this assignment requires students to decompose and document their code. This activity is particularly useful for students who are new to recursion and lists.

Picobot

In this assignment, students work either individually or in pairs to create rules for Picobot, a robot that traverses an environment. Students must create regular expression-like text rules that make Picobot traverse the entire area starting in a random position and traversing a maze. For extra credit, students can create the smallest possible rule sets. This assignment requires students to think algorithmically without the use of code and to troubleshoot the algorithms they think of. It is particularly useful for students who are new to programming and need additional practice decomposing problems.

Alien Robots!

In this lab students work either individually or in pairs to create a game of their choosing using the VPython library. To start, students are given a basic program that shows a simple alien with limited control from the user. Students are required to make incremental changes to this program, adding more complex graphics and controls to make a more interesting game. This lab reviews classes and graphics, as well as requiring students to think about the control flow for their game. It is particularly useful for students who are new to classes and need additional practice designing classes, as well as writing methods and debugging code.

The authors of this material were awarded a 2015 NCWIT Engagement Excellence Award for this assignment. Learn more on NCWIT's awards page.

Engagement Excellence

Virtual Art

In this lab students write ten methods for a Date class that stores information about the day, month, and year. Students must write methods to check whether two Dates are the same, find the next and previous Dates, find the Date some number of days in the future or past, find whether a Date is before or after another Date, find the number of days between two Dates, and find the day of the week of a Date. This lab requires students to work with classes, comparative methods, and loops. It is particularly useful for students who are new to designing classes.

Creating the Mandelbrot Set

In this lab students work either in pairs or individually to write a program that displays the Mandelbrot set. Students incrementally write functions that help them deal with nested loops, complex numbers, and graphics until they have a program that can display and zoom in/out of the Mandelbrot set. There are optional parts to the assignment that deal with visualizing escape velocities and "Mandelbrotifying" an image. In addition to reviewing nested loops and graphics, this lab requires students to use constants and use incremental design. It is particularly useful for students who need additional practice with nested loops.

Binary and Decimal Conversions

In this lab students work either individually or in pairs to write various functions dealing with binary and ternary numbers. Students must use recursion to convert between binary/ternary/balanced ternary and decimal numbers, as well as to count in binary. This lab reviews binary and ternary numbers and requires students to use recursion. It is particularly useful for students who are new to numbers in different bases and need additional practice with recursion.

Sounds good!

In this lab students work either in pairs or individually to write five functions dealing with list recursion and six functions dealing with sound manipulation. As a warmup, students must perform various operations on lists using list comprehension, such as scaling and replacing certain elements. They then manipulate sound files to play in reverse, at different volume, with static, overlaid with another file, and echoed. This lab requires students to work on list comprehension and file i/o. It is particularly useful for students who are new to Python lists.

The authors of this material were awarded a 2015 NCWIT Engagement Excellence Award for this assignment. Learn more on NCWIT's awards page.

Engagement Excellence

Python Turtles

In this lab students work either individually or in pairs to create three images using turtle graphics. Students must draw a spiral, a recursive tree, and the Koch Snowflake. In addition to reviewing turtle graphics, the lab requires students to create functions that can accept different parameters and to use recursion. The lab is particularly useful for students who are new to graphics and recursion.

Recursion Muscles

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.

Subscribe to HTML