Word up (Oops, try again. Did you create a variable called word?)


Oops, try again. Did you create a variable called word?

pyg = 'ay'

original = raw_input('Enter a word:')

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

Please I explain what I have done wrong..


Hi, @sandycoloma,

You actually have not done anything wrong. Codecademy's submission correctness test (SCT) for this exercise looks for a variable named word. If you first test your code by entering an empty string, that variable does not get created, because the else block executes instead of the if block. The SCT then issues a complaint because word was not created. In my opinion, this is a bug in the SCT rather than in your code.

The best, though not the only, remedy is to leave your code as is, and submit it again. Enter a valid word, and you will pass. After that, you can continue to test your code until you are satisfied with it.


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