Problem with print


#1

Hello,

I have a problem with print.
My code is:

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

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

When I insert for original value = 123 the program return error message. When I delete first print original row:

original = raw_input("Enter a word:")

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

the program works fine.
My question is why?


#2

because the checking script only wants you to print something if the input is alpha (a till z)

two options: enter only letters, or remove the print from line 2.


#3

hm... but first print row is outside from if/else block. That confuse me. Maybe I should read more. :wink:


#4

but this lessons check that nothing gets printed, if you enter 123, the print statement outside the if/else clauses causes a print, the lesson shows an error message