What is my mistake?


#1

in slide 5, check yourself…some more, i’ve wrote the code this way:

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

and i get the messge:
File “python”, line 4
if len(original) > 0 and original.isalpha():
^
IndentationError: unexpected indent

what have I done wrong?

Thanks


#2

the lines which should be in the if block requires indention (so in this case print original should have indent), the line with the if keyword shouldn’t have any indent at all

same applies for else keyword and the code which should be in else clause


#3

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