Object has no attribute 'isalpha' {line 6}


#1



Problem:
Welcome to the Pig Latin Translator!
Enter your name caolan
Traceback (most recent call last):
  File "python", line 6, in <module>
AttributeError: 'builtin_function_or_method' object has no attribute 'isalpha' 
Code below

print 'Welcome to the Pig Latin Translator!'

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


#2

is the name of the function. Nothing is invoked. What this line does is copy the function to original. Remove the line above it, and include the invocation in this line.

original = raw_input("Enter a word to translate: ")

Now origial will be a string, not a function.


#4

Got it solved, Thank you very much. I was far from understanding why I would have to add ("Enter a word to translate: ") but now after reading over this a few times I understand. :grin:


#5

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