Help! What's wrong with my code?


#1

This is the request:

Inside your if statement:
1.Create a new variable called word that holds the .lower()-case conversion of original.
2.Create a new variable called first that holds word[0], the first letter of word.

And this is my code:

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'

The system warns me that I didn't create a variable called word. But I had.
So what did I do wrong with it?


#2

what word do you enter when prompted? it should be something valid


#3

The wording here is tricky. Do you see in original = raw_input('Enter a word:') it mentions for 'Enter a word:' to enter "a" word? Basically, it's asking for you to enter one word. You can have it as short as "it" to as long as "supercalifragilisticexpealidocious," so long as it is one word.

That should help you move on!


#4

Thank you so much. I know what you mean and how to deal with it. Thank for your help.


#5

Yes, you are right. I ignored it. Thank you for help.


#6

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