CS1

Dealing with Data in Python

In this lab students work independently or collaboratively on slicing and indexing Python values to develop a fundamental understanding of lists. Using the Python interpreter (or shell), students begin by exploring rudimentary topics in programming using arithmetic operators, string manipulation, and list expressions. After sufficient time has been spent exploring the basic operation of the interpreter, students are to compose multiple lists from two pre-defined lists, pi and e, and perform some list operations. This lab activity is useful for students who are new to lists.

Millisoft "Shapes" Revisited

In this assignment students update an existing graphics class. Students must add methods to translate, rotate, scale, and flip arbitrary shapes using turtle graphics. They then use this class and additional subclasses to draw an image of their choice. In addition to reviewing graphics, this assignment requires students to work with a class hierarchy. It is particularly useful for students who need additional practice with classes.

Exceptional Encryption

In this assignment students work either individually or in pairs to implement and crack a simple version of RSA. As subproblems in generating RSA keys, students must generate random primes, calculate Euler's totient, and find the greatest common divisor of two numbers using Euclid's algorithm. They must then encrypt/decrypt messages using these keys and use brute force as an attack against encryption. In addition to reviewing brute force and recursive algorithms, this assignment requires students to write a program with multiple helper functions.

Huffman Compression

In this assignment students work either individually or in pairs to implement the Huffman Compression. Before beginning to code, students must write a software design document that plans the functions that they will use. The program itself must prompt the user for a file and then compress the file using Huffman Compression. In addition to reviewing trees and dictionaries, this assignment requires students to carefully design and test their code. It is particularly useful for students who are new to trees and need additional practice designing large programs that involve more complex data structures.

Secret Sharing and Lagrange Steganography

In this assignment students implement a basic security protocol in which a key is distributed to multiple parties such that a certain number of parties must combine their knowledge to learn the full key. In addition, this assignment reviews the concepts of random number generation and floating point numbers, as well as requiring students to design their own decomposition. It is particularly useful for students who need practice decomposing problems.

Engagement Excellence

Vending Machine

In this project students work independently to create a vending machine program. Using fundamental programming constructs, such as variables and conditionals, and a greedy algorithm (http://en.wikipedia.org/wiki/Greedy_algorithm), students are to construct a program that calculates the minimum number of coins necessary to make change for a particular purchase. This program introduces the concept of a greedy algorithm within the context of an example that is well-known among computer scientists (i.e. making change). The project is ideal for students who are both new to algorithms and are looking for practice with fundamental programming constructs.

Garden 2

In this project students work independently or collaboratively to calculate the area and volume of an ornamental garden. Using standard mathematical formulas in Python to calculate the area and volume of a pre-defined square plot, the students must build a program that calculates information such as the side length of the finished garden and the recommended spacing between plants. The students must use a variety of functions (such as input(), round(), and print()) to evaluate the user's input and return the proper results. As a project for primarily CS1 students, the problems outlined in the activity are suited for those with experience implementing functions and some level of comfort with implementing basic arithmetic in a programming environment. For students with limited mathematical experience this is a great way to add context around math and programming.

Engagement Excellence

Tones

In this project students create a Tone program. Using Python and knowledge of math functions, students must design a program that prompts the user for three octpch pairs. The program will convert the octpch pair into the Hz result and print the results. Optionally, the program can play the three notes using the Windows Beep function which is described at the end of the document. This assignment is particularly useful for students who are new to creating mathematical functions in Python.

Nim!

In this assignment students work either individually or in pairs to create the game Nim. Nim is a game in which two players take turns removing stones from piles with the goal of forcing the other player to take the last stone. Students must program the game from the ground up, creating their own decomposition design, as well as error checking user input. This assignment requires students to think carefully about design, documentation, and debugging. It is particularly useful for students who need practice writing larger programs.

Mastermind!

In this assignment students work either individually or in pairs to implement the game Mastermind. Mastermind is a game in which the player has to guess a sequence of randomly chosen colors based on feedback about their previous guess. Students must program the game from the ground up, creating their own decomposition design, as well as error checking user input. This assignment requires students to think carefully about design, documentation, and debugging. It is particularly useful for students who need practice writing larger programs.

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
Subscribe to CS1