Check yourself... Some more


#1

Hello everyone,

I don't know what's wrong with my code... When I type in a word that contain numbers it still prints it despite the check "original.isalphal()"... what am I doing wrong? Thanks for the help in advance.

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word!")
print original 

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

#2

lol, fixed it... I just had to remove "print original" before "if" :sweat_smile:


#3

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

why you need to put "original.isalpha(): " there?


#4

Here's what I coded:

print 'Welcome to the Pig Latin Translator!'

Start coding here!

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

When I test it out and enter a numeric value for "original", I get this error: Oops, try again. It looks like your code prints original ("123") when original includes non-alphabetical characters.

What's up with that?