4.Check Yourself! (syntax error)



Keep's Giving me this Error :

print 'Welcome to the Pig Latin Translator!'

raw_input("Enter a name.")
original = raw_input

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

Error :Traceback (most recent call last):
File "python", line 7, in
TypeError: object of type 'builtin_function_or_method' has no len()

What have i done wrong?


raw_input() prompts the user for input, which you need to store in original variable. This means you only need 1 raw_input, why do you have two?


The assignment is asking for this, we litteraly typed it over, and I don't see two.

Which one is the second one? I'm strugglin' with this one for 2 days now.
And I have the same problem in line 7.


# first raw_input
raw_input("Enter a name.")
# second raw_input
original = raw_input

the second is particular problematic, given you call the function without parentheses, so you store the function object in variable, the function object has no len attribute


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