"""
note: `pytest -s | --capture=no` shows print() output
start with a vowel, append "ay" at the end.
starts with consonants, move to the end one by one until a vowel is found.
words beginning with "x" or "y" followed by a consonant, no further transformation.
keep the āuā attached to āqā when moving characters around
my -> ym -> ymay
square -> quares -> aresqu -> aresquay
yellow -> ellowy -> ellowyay
rhythm -> hythmr -> ythmrh -> ythmrhay
"""vowels=('a','e','i','o','u')defpig_latin(word):# stages list stores intermediate transforms of the word
stages=[word]whilenotword[0]invowels:ifword[0]in'xy'andnotword[1]invowels:breakword=word[1:]+word[0]ifword[-1]=='q'andword[0]=='u':word=word[1:]+'u'stages.append(word)stages.append(word+"ay")print(" -> ".join(stages))returnword+'ay'deftranslate(sentence):return''.join([pig_latin(word)forwordinsentence.split()])