the consonants from the beginning of wordseparate the consonants at the start of this wordprefixconsonants 'while len(word and not word[ in vowelsprefixconsonants +word[ word word[ :we use loop similar to the loop that removed the non-letters from the start of wordexcept now we are pulling off consonants and storing them to variable named prefixconsonants if there were any consonants at the start of the wordthey are now in prefixconsonants and we should concatenate that variable and the string 'ayto the end of word otherwisewe can assume word begins with vowel and we only need to concatenate 'yay'add the pig latin ending to the wordif prefixconsonants !''word +prefixconsonants 'ayelseword +'yayrecall that we set word to its lowercase version with word word lower(if word was originally in uppercase or title casethis code will convert word back to its original caseset the word back to uppercase or title caseif wasupperword word upper(if wastitleword word title(at the end of the for loopwe append the wordalong with any nonletter prefix or suffix it originally hadto the piglatin listadd the non-letters back to the start or end of the word piglatin append(prefixnonletters word suffixnonlettersjoin all the words back together into single stringprint(join(piglatin)after this loop finisheswe combine the list of strings into single string by calling the join(method this single string is passed to print(to display our pig latin on the screen you can find other shorttext-based python programs like this one at