Check yourself some more, code passed but its wrong?


#1

print 'Welcome to the Pig Latin Translator!'

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

else:
print "empty"

This is my code, since .isalpha() is in, that means any number will immediately get false, but if a put 0 in for example, it still works and my code passed, can anyone explain to me please? Also empty still comes up in the console despite inputting an answer in.


#2

The above line may be removed.


#3

Thank you, can I ask why? It was required for the previous test I think? Anything else I can modify to make the code better? I wish to learn everything about it.


#4

All in good time. Continue with the track and practice each lesson. Soon you're be well enough informed to be able recognize code patterns, and be able to do essentially the same thing using different approaches. That will come.


#5

I hope so, I feel like I am learning, but not enough to remember to code from the top of my mind.


#6

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