Check yourself... Some more


#1

print 'Welcome to the Pig Latin Translator!'

raw_input("enter a word:")
original = raw_input("enter a word:")

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

else:
print "empty"

What's wrong with my code? It gives me the error:

Traceback (most recent call last):
File "python", line 6, in
AttributeError: 'int' object has no attribute 'isalpha'

Anyone know why?


#2

and now all of a sudden it worked?


#3

It only works when I don't type any letters?


#4

Couple of things are wrong with your code:

First delete this line:

You already have it under original. Also,

You are suppose to check if the user's input( aka original) contains all alphabetical letters, not if the length of it does. It should be:

original.isalpha():

#5

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