0

Hey there,
I need help writing a python program that takes your input and gives it back in a pig latin type way.
This is what i got so far:

running = True

while running:
    
    word = raw_input("Enter word:")

    if word[0] in "aeiou":
        print word + "way"

    else:
        print word[1:] + word[0] + "ay"

But it won't take more than one word.
I'm not sure how to make it give each word back in that pig latin.

It would be great if anyone could help.

Thanks !

Editor:
Please use code tags with your code to preserve the indentations. Otherwise the code is very difficult to read and not too many folks will help.

[code=python]
your Python code here

[/code]

4
Contributors
4
Replies
18
Views
8 Years
Discussion Span
Last Post by fecaled
0

heres a bit more:

running = True
sent = raw_input("Enter a sentence")

while running:

    for word in sent.split():
        if word[0] in "aeiou":
            print word + "way"

        else:
            print word[1:] + word[0] + "ay"

What i did was ask for a sentence at the start and then i split it into words using the sent.split() function, then i could do the whole sentence at once rather then one word at a time.

0

heres a bit more:

running = True
sent = raw_input("Enter a sentence")

while running:

    for word in sent.split():
        if word[0] in "aeiou":
            print word + "way"

        else:
            print word[1:] + word[0] + "ay"

What i did was ask for a sentence at the start and then i split it into words using the sent.split() function, then i could do the whole sentence at once rather then one word at a time.

how would i write the code for that?
sorry i'm a beginner i don't know what a sentance.split() function is...

0

sorry i'm a beginner i don't know what a sentance.split() function is...

Google is your friend. Or you can click here
Split() splits up (no way!) a string. If no argument is given (such as in the example by paulthom12345) it split the string up by whitespace. In English: It splits up your sentence in separate words :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.