I need some help with PygLatin


When I try to just let the Program count the length and if it contains characters it says:

Welcome to the Pig Latin Translator!
Enter a word: test
Traceback (most recent call last):
File "python", line 6, in
AttributeError: 'builtin_function_or_method' object has no attribute 'isalpha'

it says "isalpha" isn`t an attribute even though the "tutorial" and the internet is telling me that I wrote it correctly! I completely struggle with this exercise

print 'Welcome to the Pig Latin Translator!'

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


In this line:

original = raw_input

you have assigned to original function raw_input. That's why you are getting 'builtin_function_or_method' object in the error message.

What you want to do is to ask user for the input and save input in the variable:

original = raw_input("Enter a word:")


if  len("original") > 0 and original.isalpha:

why do you use "original" when you check the length and original when you check if it consists of alphabetic characters only?


Assign the output of raw_input() to your variable...

original = raw_input("Enter a word:")


I did that, now it says on the bottom of my screen:

Oops, try again. Did you remember to use .isalpha() in your code?


See the above post by @factoradic.


And did you use isalpha() in your code?

As I explained earlier - raw_input - function, raw_input() - function call. Do you see the difference? It's exactly the same thing with isalpha and isalpha().


sry but Idk what you mean......im not the best at Python......


Oh, sorry that so late, I missed the notification.

I meant that here:

if  len("original") > 0 and original.isalpha:

you are not really executing the isalpha method, you need to add parentheses:

if  len(original) > 0 and original.isalpha():


I noticed that on my own but still thanks ;D


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