Is this broken or I'm dumb?


#1



print "Bienvenido al traductor de espanol a Pig Latin."
original = raw_input('Inserte una palabra:')
if len(original) == 0 and original.isalpha():
    print original
else:
    print "Error"

"""
Isn't this suposed to check if there is no word or it has non alphabetic characters?
when I write '2039679' gives error
when I write '' gives error
but when I write 'dog' it gives error too
:cry:
"""


#2

you need to check if the user entered something (this means the length of original hs to be greater then 0) and if the entered input are all alphanumeric characters.


#3

Still don't know how is it... can you give me the answer?


#4

Okey, I got it... I was confused

Here is the solution (was more simple than i expected)

print "Bienvenido al traductor de espanol a Pig Latin."
original = raw_input('Inserte una palabra:')
if len(original) > 0 and original.isalpha():
print original
else:
print "Error"


#5

if len(original) > 0

like i said:


#6

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