PA08

A Pig Latin Translater

Objective: Get more practice with strings, looping, and writing functions

 


Code due by Wednesday, April 4th,  9:00 AM


An introduction

You are contacted by Mr. I. Hoggs, president of the IPLS (International Pig Latin Society).  He admits that despite being president of the society, he has always had some difficulty converting from English to Pig Latin.  He asks if you could help him by writing a program to convert words/sentences from English to traditional "Pig Latin." 

Pig Latin?

Some of you may have played with Pig Latin as a kid.  There are many slightly different rule sets for Pig Latin.   The version we will use is:

The Final Project

Eventually I want you to have code that will take an entire text file and convert it to Pig Latin.  For this assignment I am going to cut out the file manipulation - we will save that for later.  Instead, take in a single sentence (with no punctuation except the ending period) and translate that sentence into pig latin.

Let's think about this problem from the top down.  Our full blown project should:

  1. Read a single "sentence" from the user.
  2. Break the sentence into individual words
  3. For each word, convert it into PigLatin...
  4. by finding the first vowel (if it exists)
  5. And finally, print out these converted words in normal sentence format

As I look at this project, we want to do this in several manageable steps (incremental development), and in fact, we don't start with step one.


Part A - (Step 4) Finding the first vowel

Begin by writing  a function (in a file called pa08.py) called findFirstVowel().  This function should

For example,


Part B - (Step 3) Translating one word

Now, write another function called translateWord() that:

For example,


Part C - (Step 1, 2, and 5) Starting to translate one sentence

This turns out to have several pieces to it, so let's break it down into sub steps

Now add a function to your code called pigLatinTranslator().  This function should:

For example,


Part D - (Step 5) Reassembling the translated sentence

Now modify pigLatinTranslator from Part C to:

For example,


Final Submission

To upload your homework for grading, log on to eLearning, select this class, and navigate to the "Assignment Submissions" area. Click on the "Programming Assignment 8" folder and upload the python file in the designated location.