Need help Pig Latin lesson: Check Yourself


#1

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = words
if len(original) > 0:
    print len(original)
    
    len(original) < 5:
        print "empty"

It keeps saying invalid syntax


#2

you are check if a condition is true but you dont have the if clause here


#3

for you to pass the SCT should be an else statement not another condition,

else:
    print 'empty'

#4

it still doesn't work:

print 'Welcome to the Pig Latin Translator!'

Start coding here!

raw_input = ("Enter a word:")
raw_input = original
if len(original) > 0:
print len(original)

else len(original) < 5:
    print "empty"

#5

if you insist on writing this then you need an if or elif before the statement


#6

like this?

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
raw_input = ("Enter a word:")
raw_input = original
if len(original) > 0:
    print len(original)
    
    elif len(original) < 5:
        print "empty"

#7

Yeah but remember python relies on indentation. hence you should watch where you put the elif block. In your case you have put it inside the if block. you should move it outside.

Also one note

it should be

original = raw_input ("Enter a word:")

#8

it says there is an error with line 8


#9

Here is your code with comments

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
#prompt a user for an input and store whatever
#the user enters in original
original = raw_input("Enter a word:")

#if the user enters something
if len(original) > 0:
    #print whatever they entered
    print original

#here you are checking if the user entered nothing
#then print empty
# but you can use an else clause
#else:
#    print "empty"
elif len(original) < 1:
    print "empty"

#10

it still doesn't work


#11

what did you use for this lesson?


#12

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