Ending up


#1

https://www.codecademy.com/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096#

pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word[1:len(new_word)]

if len(original) > 0 and original.isalpha():
print original[1:len(new_word)]
else:
print 'empty'

Error message: It looks like new_word contains "missmay" instead of "issmay"!

I can't see where's the error.

Could someone help please?


#2

here:

new_word[1:len(new_word)]

you take slice of new_word, which you need to store in new_word variable so new_word contains the full translation.

are you sure you want to validate the user input (if condition) before getting first letter? If the user doesn't enter anything, you program will crash


#3

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