PygLatin -


#1


https://www.codecademy.com/courses/python-beginner-2W5v7/0/5?curriculum_id=4f89dab3d788890003000096#


The code says that len() and isalpha() doesn't exist.

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

Instead of that happening, len() and isalpha() should exist.


    print 'Welcome to the Pig Latin Translator!'

# Start coding here!
print raw_input("Enter a word:")
original = raw_input
if len(original) > 0 and original.isalpha():
    print original
else: 
    print "empty"


#2

Hello :slight_smile:

Take a look at these two lines:

print raw_input("Enter a word:")
original = raw_input

The first one says "get input from user and do not store it anywhere", the second says "assign function raw_input to the original object".

So what is the length of the raw_input function? No one knows :smiley: That is what the error message says.

You need to join these two lines into one statement:

original = raw_input("Enter a word:")

Now original will held the value inputted by the user.


#3

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