Jump to content
  • Advertisement
Sign in to follow this  
guzumba

Python program question?

This topic is 3836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.
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")



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

Share this post


Link to post
Share on other sites
Advertisement

This topic is 3836 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!