CSC 226

CSC 226 logo

Software Design and Implementation

T11: Oh, the Places You'll Go!

“You're off to Great Places!
Today is your day!
Your mountain is waiting,
So... get on your way!”

 Dr. Seuss, Oh, The Places You'll Go!

Assignment T11 should be completed in a pair programming partnership, generally two students.


  • Reflect on when to use tuples and when to use lists
  • Learn to use files
  • Understand how geographical coordinates work

Assignment Specifics

This assignment is to be completed in pairs in class.

In this team assignment, we are going to learn about where you are from, where you have visited, and where you'd like to go. To do this, we are going to leverage two data types: tuples and lists. Using the tuples and lists you create, we will use our friend, the turtle library, to create a map for you and your partner. But first, some background.

Latitude and Longitude
Latitude and longitude are geographic coordinates which can describe any single location on Earth. The planet is segmented into vertical and horizontal slices; vertical slices are called longitudes, while horizontal slices are called latitudes. Using these two values together, we can pinpoint any place on Earth by referencing a map:

A world map. Courtesy of:
Image courtesy of:

Lines of latitude, or horizontal lines, can take a value between +90 ° and -90 °, with 0° representing the Equator.
Lines of longitude, or vertical lines, can take a value between +180° and -180°, with 0° representing the Prime Meridian.

Curious where you are in the world? This website will let you put in an address and it will provide you with your geographic coordinates:

For this assignment, you and your partner will use latitude and longitude to plot specific places on a map:
  • Where both of you are originally from
  • Any place you've visited, or would like to visit, in your lifetime

You will then plot those locations onto a world map. Each partner will get two colors: one color for places they've visited, one color for their home. Each place will also get some text printed next to each item to let us know more about that location.

Tuples vs Lists

Syntactically, tuples are Python data structures which use ( ) as the syntactic container, and lists are data structures which use [ ] as the syntactic container, but what other differences are there? Tuples are immutable, while lists are mutable, but what exactly does that mean?

Once you create a tuple, you cannot edit it; it is immutable. Lists on the other hand are mutable, you can edit them. With lists, you can also add items and delete items; but you can't do either with a tuple, because tuples have a fixed size once they are created. As a consequence of this mutability difference, accessing data in tuples can be faster.

In addition, lists are most typically used with homogeneous collections of data. By homogeneous, we mean the items contained in the list often represent the same concept. Tuples are most often used with either homogeneous or heterogeneous collections of data which are related to one another, but do not change. By heterogeneous, we mean the items contained in a tuple often express different but related concepts. For example, a name and a birth place are heterogeneous, and should be stored in a tuple, and a person's place of birth would never change. A collection of birth places are homogeneous, and therefore should be stored in a list (plus, you may want to add/remove a person's birth place from the list).

Using Files and Strings

Here is a python program which opens a plain text file, reads it, reverses the lines (just for fun).  It also writes a new file which is what you need to do in this teamwork. Copy both the program and the provided text file, putting them into the same folder:
Run this program to get experience opening and using files.  The poem is fun too. :)

Instructions for this Assignment

  • Download the following starter code and background image:
  • Unzip the folder. Make sure to keep the program and the image files in the same folder as your code.
  • Change the name of the program to
  • Run the program using the provided file as input. Note that it must reside in the same folder as the program.
  • Run the program interactively getting latitudes and longitudes from
  • Complete the descriptive header as a comment at the top of your source code.
  • Read over the code and discuss it with your partner, paying particular attention to the lists and tuples.
  • By the way, you will see "FIXME markers" in the comments of this program.  Programmers, particularly those working in teams, often place TODO and/or FIXME markers in their code which serves as a reminder for tasks that need to be completed and/or things which need to be fixed. Many Integrated Development Environments (IDEs), including Spyder, PyCharm, Eclipse, and Visual Studio just to name a few, will recognize and highlight FIXME markers in a special way.  They mark what you need to complete for this teamwork. Basically, you need to write code which creates the kind of file which can later be used for input. Hence, you can test your code by re-running the program and using the file you created as an input file.
  • Be sure to use meaningful variable names.
  • Note that to represent a single place, we used a tuple, but to represent all the places, we used a list. With your partner, discuss these two data structures, when one is more applicable than the other, and why. After discussing with your partner, create a word document named yourusernames-T11.docx, put your names at the top and answer the following questions:
    1. Identify all uses of lists in the code.
    2. Identify all uses of tuples in the code.
    3. From your text reading, when is a tuple a more appropriate data structure to use than a list? Briefly explain.
    4. From your text reading, when is a list a more appropriate data structure than a tuple? Briefly explain.
    5. Tuples are immutable; lists are mutable. Would lists have been better for representing a single place, and tuples better for representing all places? Or did Dr. Scott and Dr. Jan use the most appropriate data structures for each? Justify your response by explaining your answer.
    6. Consider another problem: representing patient data for hospital records (i.e., patient name, date of birth, social security number, health records...). Which data structure is more appropriate for this problem? Again, briefly justify your answer.
  • If you finish the requirements before the end of class, please modify your map to make it even more amazing... explore!
  • The driver should upload to Moodle. Be sure all contributors to the assignment are acknowledged in the header block.
  • The navigator should upload yourusernames-T11.docx to Moodle. Again, be sure all contributors names are on the assignment.

Copyright © 2016 | | Licensed under a Creative Commons Attribution-Share Alike 3.0 United States License