Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Pig latin translater

#Take the users input
words = raw_input("Enter some text to translate to pig latin: ")
print "You entered: ", words

#Now I need to break apart the words into a list
words = words.split(' ')

#Now words is a list, so I can manipulate each one usinga loop

for i in words:
    if len(i) >= 3: #I only want to translate words greater than 3 characters
        i = i + "%say" % (i[0]) 
        i = i[1:]
        print i
    else:
        pass

does this work at all

1 Like

Is it in python? If so I will try it.

1 Like

yes that is python @Archipelago-Gold

okay one second. I’ll test it for you.

1 Like

okay thank you because i made it but the chromebooks dont have a way for me to test it

Guess what bud. It works here is an IDE you can use. https://repl.it/~ Good luck and nice work :+1:

1 Like

thank that is what i did in like 1 to 2 hours

That’s a good time for a translator. Good work and keep it up. :smile:

1 Like

Does that link work for you? If not I will give you another one.

1 Like

yes it does thank you

Okay good. Have a good day. Also i recommend possibly putting your code in a loop so they can translate more than once before the program stops that is the only recommendation I have for it otherwise it is well done.

1 Like

okay i am adding a

while():
    #Take the users input
words = raw_input("Enter some text to translate to pig latin: ")
print "You entered: ", words

#Now I need to break apart the words into a list
words = words.split(' ')

#Now words is a list, so I can manipulate each one usinga loop

for i in words:
    if len(i) >= 3: #I only want to translate words greater than 3 characters
        i = i + "%say" % (i[0]) 
        i = i[1:]
        print i
    else:
        pass

try it now

That won’t work, you have to either do a while true loop or a while loop.

1 Like

Yes you have to have a while true.

1 Like

You know what it works as it is and I can’t get a loop to work with this code so just keep it as it is okay? It won’t work with a loop for some reason so it will be good as is. Good work

1 Like

actuall it does not work it says raw imput is not defined

I know I already tried editing in the loop it is okay as is. Where are you planning on putting this code?

1 Like

on a blog i am making

Hmmm not sure if this will work but maybe change raw_input to input

1 Like

nope that doesn’t work either we will just have to leave it as is.

1 Like