Word up


#1




I have a question.
Why do I have to put "word = original.lower()" and "first = word [0]" within if statement?
And why does it not work when I put codes above before if statement, even if replacing "len(original)" with "len(word)" along with "word.isalpha()"?
Does anyone have an answer? Help!


pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

Because these lines,

Are supposed to run only when this condition is met,


#3

Thanks. I finally understood.


#4

Awesome! :grin: also please read this post,


#5

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