11. Testing, Testing, is This Thing On


#1

hi guys, i did a little bit check myself and yes at the end managed somehow to get it work well with Piggy translator.
but what if i want to write down not only one word but more words i mean sentences and translate every single word in sentence as well??? any ideas?

def PygLatin():
    pyg = 'ay'

    original = raw_input('Enter a word:')

    if len(original) > 0 and original.isalpha():
        word = original.lower()
        first = word[0]
        new_word = word + first + pyg
        new_word = new_word[1:len(new_word)]
        print new_word
    else:
        print "try one more time\n"
        return PygLatin()
PygLatin()


#2

What i am about to say, might not be covered in the lessons yet. First things first, getting user input:

pyg = 'ay'

original = raw_input('Enter a word:')

now, raw_input will get you unicode, rather annoying, we want a string, so we are going to do this by using the build in function str() to cast it to a string:

original = str(raw_input('Enter a word:'))

now, we want to use a list, so we can loop over the words, so we are going to use split:

words = original.split(' ')

this will give a list with all the words, which you now can loop over:

for word in words:
   print word

now, this might run ahead of the lesson a little bit, you might want to continue with the course first, but this should help you going


#3

i am breaking my head about 2 hours on it but no result, maybe want to jump over my head at the beginning , hope at the end of course i will be able to find how to add letters to the end of each word in input or even alternate them . anyway, thanks for response i have learned smth new .


#4

i think you are going outside your league. First continue the course, i doubt split even gets covered. You will understand this later