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.
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. |
Here is how you translate words into Pig Latin:
Separate each word into two parts: prefix and stem.
Examples:
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:
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:
len
and
string.split()
You may not use, e.g., str.find(), str.replace(),
etc.
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.
These are the aspects of your work that we will focus on in the grading:
Correctness (98%): Appropriate since the structure and test cases are given to you.
Formatting and programming style (2%): Make sure what you add follows style guidelines.
These are the aspects of your work that we will focus on in the grading:
Correctness (92%): Your functions and your main program should perform as specified.
Formatting and Program style (5%): Make sure that you read the style rules page for some general rules and guidelines about formatting your code.
Appropriate Test cases (3%): You should test general cases as well as specific cases.