vowels= "aeiou"
word = raw_input("Type a word: ")
def change_word_into_piglatin():
if word[0] not in vowels:
print word[1:] + word[0] + "ay"
else:
print word[0:] + "shay"
print change_word_into_piglatin()
raw_input("Press ENTER to exit")
Python program question?
Hi everyone! Im having trouble making a function to change one word of English
into pig-latin. I am able to change a word starting with 1 consonant, but not
a word with 2 or 3.
For example I can change
english = "hello",
into,
pig-latin = "ellohay".
but not,
english = "three"
into,
pig-latin = "eethray"
In pig-latin you are supposed to move every consonant(not just the first letter of the word)before the first vowel to the end of your word and add "ay".
I have this code so far for defining my function.
This code works fine for the word "hello", but doesnt work for "three". Can someone please help me?? And for some reason it keeps printing out "None" in the output and I wasnt sure why? Could someone help me with that too?
Thanks
Andrew
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement