CSC 221: Introduction to Programming
Fall 2012

HW 5: Text Processing

Note: this work must be entirely your own, with no outside assistance other than the instructor.


Part 1: Codingbat Practice

CodingBat is a free, educational site developed by Nick Parlante at Stanford. It contains short programming problems that can be completed online, either in Java or Python. Problems are divided into categories such as String-1 (String manipulation exercises) and Logic-1 (conditionals and boolean logic exercises). Each problem provides a small description and then requires you to enter the code into a function skeleton. When you click on the Go button, your code is automatically compiled, executed, and graded in the page.

For the first part of this assignment, you must complete:

In order to receive credit for your work, you must create an account at CodingBat and list me as your instructor (davereed@creighton.edu). That way, I can review your answers and keep track of how many you have solved. Note: you must be logged in when working on problems in order for CodingBat to remember you work.

Part 2: Language Translation

For the second part of the assignment, you will make modifications to a simple language translator program. The file hw5.pytxt contains a function that can be used to translate text by simple word/phrase replacement. For example, by replacing every occurrence of the English word "bathroom" with the corresponding Spanish word "bano." The translate function takes three inputs, the names of the source file (the file to be translated), the vocabulary file (the corresponding phrases in two languages), and the destination file (the file where the translation is to be stored).

Two different vocabulary files, spanish.txt (English to Spanish) and pirate.txt (English to Pirate), have been provided for you. Each line in that file consists of an English word/phrase and its corresponding translation, separated by "|".