PygLatin: I don´t really get how .isalpha() actually works!


Hi everybody, thanks for attending.

I supose this code to show me “empty” as an uotput if the string entered by the user has any non-alphabetical character. If the input just contains letters I should get the string printted.

The thing is that even if the string has any numerical character the code stills prints both the “string” and the “empty” outputs, and that shouldn’t happen since the conditional is working properly.

This is the code I’ve written, please check it out and tell me if you find the mistake.

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

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

print “empty”


There should only be one print original statement, in the if statement.


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