Word Up Lesson: little confusion on 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
    print 'empty'


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.


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