Ending Up


#1

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
print original
word = original.lower()
first = word[0]
new_word = word + first + pyg
print new_word[1:len(new_word)]
else:
print 'empty'

I don't get it


#2

Hi @sammygun,

Instead of this ...

print new_word[1:len(new_word)]

... assign the result of that slice operation to new_word, and then you can do this ...

print new_word

#3

Do you mean this?


#4

According to Codecademy's test, that works. :smiley:

You have assigned the translated input to new_word.

However, it would be best to move these two statements into the if block ...

first = word[0]
new_word = word[1:] + first + pyg

This way, we make sure that the user entered a valid word before we perform the translation process.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.