Write an application that accepts a word from a user and converts it to Pig Latin. If a word starts with a consonant, the Pig Latin version removes all consonants from the beginning of the word and places them at the end, followed by ay. For example, cricket becomes icketcray. If a word starts with a vowel, the Pig Latin version is the original word with ay added to the end. For example, apple becomes appleay. If y is the first letter in a word, it is treated as a consonant; otherwise, it is treated as a vowel. For example, young becomes oungyay, but system becomes ystemsay. For this program, assume that the user will enter only a single word consisting of all lowercase letters.

Respuesta :

Answer:

Written in Python

word = input("Word: ")

if(word[0]=='a' or word[0]=='e' or word[0]=='i' or word[0] =='o' or word[0]=='u'):

     print(word+"ay")

else:

     a = word[1:]

     print(a+word[0]+"ay")

Explanation:

The program was written in Python and I've added the explanation as an attachment; where I used comments as explanations

Ver imagen MrRoyal