Syntax Error for Exercise 10 Ending Up


#1

https://www.codecademy.com/courses/learn-python/lessons/pyglatin/exercises/ending-up

Syntax Error for my else statement, not sure where I went wrong, this is the error I get:
File “python”, line 12
else:
^
SyntaxError: invalid syntax

I expected my code to run without errors and prompt me to input a word to be translated, but instead I run into that error, any suggestions? My code is below:

```
pyg = 'ay'
original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
	print original
word = original.lower()
print word
first = word[0]
newword= word + first +pyg
print newword
newword = newword[1:len(newword)]
print newword
else:
	print 'empty'


#2

From the variable word all the lines of code before else should be inside of if.


#3

Thank you! That was a dumb mistake on my part.


#4

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