PygLatin Translator not wokring for long words


#1



Testing, Testing, is This Thing On?

My code works fine until I type long words (around 16 or more letters). At this point it truncates the word so my PygLatin word is the same length or shorter than the original word I put in. For example, "sesquipedalianism" becomes "esquipedalianisay."

I don't see anything in the code that should limit the length of the word, so it seems like my PygLatin word should always include all of the letters from my original word, plus the 'ay' ending.


pyg = 'ay'
original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word[1:len(new_word)] + first + pyg
    
#For testing 
    print len(original)
    print len(word)
    print len(new_word)
    
    print new_word

else:
    print 'empty'


#2

somehow your code is limiting you

new_word = word + first + pyg
new_word = new_word[1:len(new_word)]

guess you first need to add first + pyg + word then remove 0 index


#3

Hi! I tested your code and it worked fine, it printed out "esquipedalianismsay", just the way it's supposed to :slight_smile:

btw, in line 7 of your code, change
new_word = word[1:len(new_word)] + first + pyg
to
new_word = word[1:len(word)] + first + pyg
since this would result to an error later