The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 5 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
For Intro to Python Class.
Â
Pig Latin is a language game in which words are altered according to certain rules.Â
To make the pig latin form of an English word, the initial consonant sound is transposed to the end of the word, and an "ay" is affixed. Specifically, there are two rules:Â
For example:Â
(a) In the file problem1.py, write a function
def piggify(word):
...
that takes an input String word as its parameter and returns a string containing the pig latin translation of the word. You can assume that the input is always a lower-case string (no input verification is necessary).Â
Hints: Use indexing and slicing. You might also want to use a string of vowels and then use the in operator to check if a letter is a vowel.
vowels = 'aeiou'
(b) In the same file, write a program that repeatedly prompts the user to input a new word and then prints the pig latin translation of the word (by calling the piggify function). When the user types a single period, the program should quit.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly