CS0008 Assignment 2

Introduction

The purpose of this assignment is to give you practice writing and debugging code, problem solving, and working with strings, lists, while loops, and for loops.

This must be your own individual work. Do not look at anyone else's solution (or even part of it), and do not let anyone else look at yours (or even part of it). You should figure out the solutions by yourself --- don't ask anyone how to solve the problem, and do not seek the answer from some other source. The only way to learn how to program is to go through the problem-solving and debugging process yourself. It is fine to ask questions about Python itself, however.

Part 1: Igpay Anslatortray

Translation to Pig Latin! Write the following functions, and call them by using the function and main program provided for you

Function Name Specification
transWord(word) Given an English word (a string of upper and lower case letters), return that word translated into Pig Latin (a string).
transSent(sent) Given an English sentence (a string of words separated by spaces with no punctuation), return that sentence translated into Pig Latin, where the words are separated by single spaces and the string ends with the last word followed by '.' (there should be no extra spaces).
isAllVowels(st) Given string st, return True if every character is a vowel, False otherwise.

Translation Rules

Here is how you translate words into Pig Latin:

  1. Separate each word into two parts: prefix and stem.

    Examples:

  2. Once you have the prefix and stem for a word, form the Pig Latin translation by switching the order of the stem and prefix and adding the letters "ay" to the end.

    Examples:

  3. There is one special case for words with no consonants, like "I" and "a". For these words, the prefix is the empty string ("") and the stem is the word itself. However, "yay" is added to the end of the stem rather than "ay".

    Examples:

Restrictions

You are restricted in the programming features to use for this assignment. Assignments that do not follow these restrictions are not acceptable.
  1. You may only index strings with simple integers >= 0. Suppose 'word' contains a string and 'i' contains an int >= 0. 'word[i]' is ok, but you cannot also use ':' or multiple numbers.
  2. You may use + to concatenate strings.
  3. The only built-in functions or methods you may use are len and string.split() You may not use, e.g., str.find(), str.replace(), etc.
  4. You must use the functions provided for you
These restrictions are not to be mean. With them, I know you will get essential practice, e.g., with for loops and while loops. I could have assigned a problem that involves complex calculations, but strings are more fun to work with and easier to check.

Part 2: Palindromes

Write a program that input strings until the user enters "STOP!", and, for each string, prints 'yes' if the string is a palindrome, and 'no' otherwise. The strings may contain punctuation. There are no restrictions on how you write this program. Here are more examples than you could wish for ...

Submission

Submit two programs, assign2Part1.py which should contain your functions plus the functions given to you, and assign2Part2.py, which should contain your palindrome program. For Part 2, you should also submit screen_capture.txt, showing a run of assign2Part2.py on a good set of test cases. You can do this by running IDLE, and saving the Python shell.

Grading for Part 1

These are the aspects of your work that we will focus on in the grading:

Grading for Part 2

These are the aspects of your work that we will focus on in the grading: