Question: Provide a python code Pig Latin is a pseudo-dialect of English most used by children. It usually is spoken, but occasionally is written as well.
Provide a python code
Pig Latin is a pseudo-dialect of English most used by children. It usually is spoken, but occasionally is written as well. There are several variations of rules for Pig Latin. The dialect that we will use follows these rules:
1. If a word begins with a consonant or consonant group, move the consonants to the end of the word and add ay. 2. If a word begins with a vowel or vowel group, leave the vowels in place and add yay to the end of the word. 3. Retain all capitalization, punctuation, and spacing.
For example, maybe -> aybemay flood -> oodflay strangely -> angelystray able -> ableyay out -> outyay ought -> oughtyah Ooh! This, is an angry, Grand test! So, stretch. -> Oohyay! Isthay, isyay anyay angryyay, Andgray esttay! Osay, etchstray.
Write a fruitful function called piglatin() that translates a single English word into Pig Latin following those rules using regular expressions to accomplish the work. Write a main driver that requests a file name from the user. It then translates the entire file into Pig Latin, displaying its results on the console. Run your program several times using different inputs sufficient to demonstrate that your program meets all the assignment requirements. Two of your inputs must be the files PigText1.txt and PigText2.txt. Capture a screen shot of each run.
PigText1.txt
When you hear the words, "Once upon a time," Then you know a story will be told... When you hear me say, "Once upon a time," A wondrous adventure will be unfold.
PigText2.txt
There are strange things done in the midnight sun By the men who moil for gold; The Arctic trails have their secret tales That would make your blood run cold; The Northern Lights have seen queer sights, But the queerest they ever did see Was that night on the marge of Lake Lebarge I cremated Sam McGee.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
