Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def word_to_piglatin(word):
- beginning = 0
- uppercase = word[0].isupper()
- word = word.lower()
- for n in range(len(word)):
- if word[n] == "q" and word[n+1] == "u":
- beginning = n+2
- break
- if word[n] in vowels:
- if word[n] == "y" and n == 0:
- continue
- else:
- beginning = n
- break
- piglatin = word[beginning:]+word[0:beginning]+"ay"
- if uppercase:
- piglatin = piglatin[0].upper() + piglatin[1:]
- return piglatin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement