Another stuck on my code (Check Yourself...Some More)


I now wrote this code:

print 'Welcome to the Pig Latin Translator!'

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

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

And the output was:

Welcome to the Pig Latin Translator!
Enter a word: 89

With the error message:

Oops, try again. It looks like your code prints original ("89") when original includes non-alphabetical characters.

Any errors in my code?


delete this line...
print original


It works perfectly. Thanks.


Can you tell me how this worked?


Yeah,In problem we have to print original after we check if its non empty string and not a string containing numbers.
as you printed it earlier so string with numbers as characters also got printed!


I see now. Thanks so much for helping me! :blush:


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