Important Note

Tufts ended funding for its Open Courseware initiative in 2014. We are now planning to retire this site on June 30, 2018. Content will be available for Tufts contributors after that date. If you have any questions about this please write to

Tufts OpenCourseware
Author: Ming Y Chow

Tufts OpenCourseWare
Introduction to Game Development
M. Chow
Spring 2012



Lab 1: Practice with Python

This lab is worth 5 points. Instructions: Please complete the following set of programs. Please only use the following resources:

1. Write a program that prints the numbers from 1 to 100. But for multiples of three print Fizz instead of the number and for the multiples of five print Buzz. For numbers which are multiples of both three and five print FizzBuzz. Yes, this problem comes from this classic article:

2. Write a program called where you create a list of items and print it reversed. Please make this program as short as possible! For example, a list with three strings Tom, Dick, and Harry shall be printed:


3. Download list of historic places in the northeast region provided by the National Register of Historic Places: Uncompress the ZIP to find a tab-delimited file ne_landmarks.txt. The list has 18,246 records. The file has four (4) columns:

  • Longitude
  • Latitude
  • Name (of historic place)
  • Info

Write a program that counts the number of words in the file ne_landmarks.txt above. Your program must count how often each word appears in the file and prints:

word1 count1
word2 count2
word3 count3
word4 count4

Print the above list in order sorted by word. Store all the words as lowercase, so 'The' and 'the' count as the same word. The last line of the output will be the total number of words in the file (example: There are 576 words in this file.).

BONUS: Modify the Python program to count the number of words of any input file!

4. Write a class named Song (save it as The idea is to keep track of a music collection. This class maintains organizational information about a song: title, artist, and album. The Song class must include the constructor def __init__ (self) and a method output(). You should have multiple parameters for your constructor method. Then, instantiate a few songs (of your own) and then call the output() method for each song that you create. Your output must be in the following format:

Title: "Mandy"
Artist: Barry Manilow
Album: Barry Manilow II

Title: "Where the Streets Have No Name"
Artist: U2
Album: The Joshua Tree