CS 115 Lab 13, Spring 2015
Deadlines
- Pre-lab: Tu 4/28/2015 at 7 AM
- Writeup and code (lab13b.py): Tu 5/5/2015 at 4 PM
- Demo (part B): Any lab section, workshop, or open tutoring session before Tu 5/5 at 4 PM.
Your last chance is the Tuesday tutoring from 3-4 PM.
Goals
Upon successful completion of this lab, you should be able to understand and write programs using:
- The __str__ and __lt__ methods
- Lists of objects
Pre-Lab Assignment
Click here for the pre-lab instructions.
Even if you didn't get to the pre-lab by the deadline, you should work through it before proceeding with the rest of the lab. A PDF of the
pre-lab is available on Moodle.
Setup
- Before you start writing code, you will set up a directory for this assignment
on the cwolf server. To connect to cwolf, do one of the following:
- Enter your CS 115 subdirectory by typing
cd cs115
- Type pwd (print working directory) and verify that the output is:
/home/student/yourusername/cs115
- Create a directory for Lab 13 by typing
mkdir lab13
- Enter your Lab 13 directory by typing
cd lab13
- Type pwd again, and verify that the output is:
/home/student/yourusername/cs115/lab13
- In this lab, you will use two lists of students as input files.
Copy these files from my cwolf directory to yours by typing the following command:
cp ~srivoire/cs115/pickup/cities*pop.txt ~/cs115/lab13/
- Type
ls
(that's a lowercase L followed by a lowercase S). If you copied the file correctly,
you should see a list of 2 files.
- Decide whether you want to work directly on cwolf ([remote]) or work on IDLE at your local computer ([local]), and follow the relevant instructions for the rest of the lab.
- If you're working locally, right-click or control-click to download these files into your default Python directory (C:\Python34 on Windows or Documents on a Mac): cities-pop.txt
and cities-small-pop.txt. Take a look at the contents of these files,
but do not make any changes to them.
- If you're working remotely (directly on cwolf), use emacs to open each of these files and notice how they differ from the old lists of cities, but don't make any changes to them.
Lab Instructions
Follow the links below to complete each part of this lab.
- Define a City class
- Sort City objects
- Submit your code