Word Up Lesson: little confusion on instruction


#1

INSTRUCTION:
"Inside your if statement:

Create a new variable called word that holds the .lower()-case conversion of original."

My question is, when it says inside your "if statement", why can't I code it right after original.isalpha(), rather I have to code it in the next line

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    print original
else:
    print 'empty'


#2

because everything on that line is part of the if condition, and because python relies on indent for such things, you need to the lowercase conversion on the next line.

It is a good thing as well, if you clutter everything in one line, the code becomes so unreadable.


#3

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