Need help with len code


Whenever I put this code

print 'Welcome to the Pig Latin Translator!'
original = raw_input
# Start coding here!
raw_input("Enter a word:")
if len(original) > 0:
else: print("empty")

An error comes up that says
 Traceback (most recent call last):
  File "python", line 5, in <module>
TypeError: object of type 'builtin_function_or_method' has no len()

Can someone please help


Hi @bytesolver97039 ,

This line assigns the raw_input function, itself, to original, which is not what we need to do ...

original = raw_input

This line calls the raw_input function, but does not save the user's input ...

raw_input("Enter a word:")

Replace the two lines with the single statement ...

original = raw_input("Enter a word:")


Need help akso my code

Start coding here!

original = raw_input("Enter a word :")

If len(original) >0 :
print original
print "empty"

len statement has error


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