Need help with len code


#1



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:
    print(original)
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


#2

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:")

#3

Need help akso my code

Start coding here!

original = raw_input("Enter a word :")

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

len statement has error


#4

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