Check Yourself


I need help I don't understand what I did wrong it says

Welcome to the Pig Latin Translator!
What is your name? paul
Traceback (most recent call last):
File "python", line 5, in
NameError: name 'has_chars' is not defined

can someone please help me.

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input('What is your name?')
if has_chars(the_string) and the_string.isalpha():
    print the_string
    print "empty"


Ok so first, your original statement is fine. Secondly, you need original to equal a string so put it equal to " " not has_chars etc. Thirdly, you completely forgot about the first numbered instruction: Add an if statement that checks that len(original) is greater than zero. Don't forget the : at the end of the if statement! Fourthly, instead of print the_string you need print " ". So the basic outline should look something like this:

original = raw_input(What is your name?")
original = ""
if do something with len(original)
    print ""
    print "empty"


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