You should use original
, not "original"
.
"original"
is a literal string, while original
is a variable name.
Over here:
len ('original')
^ ^
Question
print "Welcome to the English to Pig Latin translator!"
original = raw_input ("please, type a word")
if len ('original') > 0 and original.isalpha():
print original
else:
print "empty"
What i'm trying to do is just make sure that the users input has more than 0 characters and make sure that are all letters, but when i write a number it prints the number, not "empty"
Solution
You should use original
, not "original"
.
"original"
is a literal string, while original
is a variable name.
Over here:
len ('original')
^ ^
OTHER TIPS
You probably mean len (original)
- otherwise it will always be true (you are calculating length of the string "original".