Course Home | Assignments | Class Photo | Computing Resources | Lab Hours/Tutoring | Schedule | Submit

Saint Louis University

Computer Science 150
Introduction to Object-Oriented Programming

Michael Goldwasser

Spring 2010

Dept. of Math & Computer Science

Programming Assignment 02

DNA Reversal

Due: 11:59pm, Wednesday, 3 February 2010


Contents:


Overview

Your assignment is to complete an implementation as describe by Exercise 2.37 of the text.


Collaboration Policy

For this assignment, you are allowed to work with one other student if you wish (in fact, we suggest that you do so). If any student wishes to have a partner but has not been able to locate one, please let the instructor know so that we can match up partners.

Please make sure you adhere to the policies on academic integrity in this regard.


Advice

In some sense, this would be an easier assignment later in the course when we have more tools available in our repertoire. Yet we already know enough to accomplish this task if we carefully use the methods of both the str class and the list class.

One challenge is the need to reverse strings. You will need to reverse the original marker to get its inverted form and later to reverse the substring between the marker pair. In an ideal world, the str class would support a reverse() method - but alas, no such method exists. However, negative slices can be used to produce a reversal. See the "For the Guru" box on page 55.

The other big challenge is to properly identified the portion of the DNA between the marker pair. Again, there is more than one way to accomplish this, but the most likely approach to take is to use the index method of a string to find the location of the markers and then to properly identify the strand between then. Once that is done, it should be possible to calculate the reversal of that intermediate strand, and to piece together the various portions of the DNA for the resulting output.


Submitting Your Assignment

You should create a new file, dna.py, which contains all of your own code. This file must be submitted electronically.

You should also submit a separate 'readme' text file. If you worked as a pair, please make this clear and briefly describe the contributions of each person in the effort.

Please see details regarding the submission process from the general programming web page, as well as a discussion of the late policy.


Grading Standards

The assignment is worth 10 points.


Extra Credit

We have suggested that the most natural solution to this assignment is based upon use of the index (or equivalently, the find) method of the str class.

Even without use of the index or find methods, it is still possible to accomplish the desired task based only upon the use of the other str and list methods we have discussed. For extra credit, give such a solution to this assignment.

So as not to risk losing points on the required part of the assignment due to a failed extra credit attempt, please submit an original version of your assignment in a file dna.py and the separate extra credit version in a file dnaExtra.py.


Michael Goldwasser
Last modified: Tuesday, 02 February 2010