Indentation errors are the bane of my existance


#1



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


File "python", line 5
    if len(original) > 0:
   ^
IndentationError: unexpected indent

I tested all of my spaces and tabs, it looks fine.


I expected it to move onto the next section.


print 'Welcome to the Pig Latin Translator!'

original = raw_input ("Enter a word")

    if len(original) > 0:
        #print "%s" %(original)
    else:
        #print "empty"


#2

The if else statement should not be indented whatsoever because the block of code is not inside a loop or function.

Happy Coding :grinning:,
harrypotter91


#3

@harrypotter91 See I originally thought so too, and it returned another error

 print 'Welcome to the Pig Latin Translator!'

original = raw_input ("Enter a word")
if len(original) > 0:
    #print "%s" %(original)
else:
    #print "empty"

 File "python", line 6
    else:
       ^
IndentationError: expected an indented block

#4

Hmm...let me check the exercise.


#5

this if clause can't be empty, a comment isn't enough, you need an actual line of code which does something (like printing original)


#6

print 'Welcome to the Pig Latin Translator!'

original = raw_input ("Enter a word")
if len(original) > 0:
    print "%s" %(original)
else:
    print "empty"

Thank you! Fixed.


#7

Yep, @stetim94 is right.


#8