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


#1

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
      
  
else:
    print 'empty'

Please I explain what I have done wrong..
Thanks


#2

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.


#3

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