9/11: keep getting a error


#1

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 'empty'

When I run it I get a: Oops, try again. It looks like new_word equals "ellohay" instead of "hellohay"!


#2

@mrsmith12 You have assigned the raw_input statement to a variable, also the seventh line of code doesn't need to be there; and I suspect that's what's causing the error! Try this:

original = 'Dobby'
pyg = 'ay'
if len(original) > 0 and original.isalpha():
word = original.lower() #1 indent here and on the next three lines
first = word[0]
new_word = word + first + pyg
print original
else:
print'Empty' # 1 indent


#3

thanks, I really appreciate it.


#6

hello I am stuck to plz
plz
plz


#23

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(original)] + first + pyg)

print new_word

else:
print 'empty'

Without the 1:len(original) it's just going to display the whole word and not from the first character. Hope I helped. Also, new word works there as well.