Why is it telling me this? (Ending Up) [SOLVED]


#1


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

This is the code:
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 original

else:
print 'empty'

These are the error messages:
File "python", line 12
else:
^
SyntaxError: invalid syntax


#2

you aren't trying to slice from new_word you are trying to slice from what is typed in, which is the raw_input so you would put.
new_word = original[1:len(new_word)]


#3

I solved it myself, but thanks for the suggestion!


#4

I had an indentation issue, that's it.


#5

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