Created
July 31, 2015 03:47
-
-
Save duonghau/9d8ade2079b90a135eb1 to your computer and use it in GitHub Desktop.
Pig latin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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