Skip to content

Instantly share code, notes, and snippets.

@duonghau
Created July 31, 2015 03:47
Show Gist options
  • Save duonghau/9d8ade2079b90a135eb1 to your computer and use it in GitHub Desktop.
Save duonghau/9d8ade2079b90a135eb1 to your computer and use it in GitHub Desktop.
Pig latin
#author Duong Tien Hau
#function: Pig Latin is a game of alterations played on the English language game.
#To create the Pig Latin form of an English word the initial consonant sound is
#transposed to the end of the word and an ay is affixed
def main():
string=input("Enter a word:")
print(pigLatin(string))
def pigLatin(string):
pigstring=''
vowels='aeiou'
if string[0] in vowels:
pigstring=string+"yay"
else:
index=0
while string[index] not in vowels:
index+=1
pigstring=string[index:len(string)]+string[0:index]+'ay'
return pigstring
if __name__=="__main__":main() []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment