id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs112fall2015 > piglatin2
prev  |  next  |  chance

In this exercise we will make the rules for Pig Latin more complete. Like in the first version of piglatin, An English word is translated into Pig Latin by the following rules: if the word starts with one or more consonants then they are moved to the end, and "ay" is added to the end after that. If the word starts with a vowel, then just add 'way' to the end. In addition, there are three new rules: (1) in the initial sequence of consonants, a 'qu' counts as consonants. (2) If the original word is all uppercase, the final result should be all uppercase, and if the original word was "title case" (meaning first letter uppercase and rest lowercase) then the result should be too: 'AAA' becomes 'AAAWAY' and 'Pig' becomes 'Igpay'. (3) 'Y' is considered a consonant at the start of a word but a vowel in the middle, so 'style' becomes 'ylestay' and 'yellow' becomes 'ellowyay'.


piglatin2('MBA') → 'AMBAY'
piglatin2('AM') → 'AMWAY'
piglatin2('Pig') → 'Igpay'

...Save, Compile, Run (ctrl-enter)

def piglatin2(word):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 211 Post-solution available

Copyright Nick Parlante 2017 - privacy