Skip to content

Instantly share code, notes, and snippets.

@JPierceM3
Created October 15, 2019 01:11
Show Gist options
  • Save JPierceM3/c85c5471a8a3c8d917c7973233a8a727 to your computer and use it in GitHub Desktop.
Save JPierceM3/c85c5471a8a3c8d917c7973233a8a727 to your computer and use it in GitHub Desktop.
print("This Program converts to Pig Latin, then prints both the original word and the Pig Latin version to the console. The program continues reading words until the user enters 'stop'.")
def pigLatin(ll):
flag = 0
if(ll[0] == "a" or ll[0] == "e" or ll[0] == "i" or ll[0] == "o" or ll[0]== "u" or ll[0] == "y"):
flag = 1
elif(ll[0] == "A" or ll[0] == "E" or ll[0] == "I" or ll[0] == "O" or ll[0]== "U" or ll[0] == "Y"):
flag = 1
if(flag == 1):
s = ll[1:] + ll[0]
s = s + "ay"
return(s)
s = ""
while(s!= "stop"):
s = input("Enter a word to convert to pig Latin enter stop to end: ")
if(s != "stop"):
p = pigLatin(s)
print(s +" is pig latin is: " + p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment