10/11 error


error :Traceback (most recent call last):
File "python", line 9, in
NameError: name 'word' is not defined

My Code : pyg = 'ay'

original = raw_input('Enter a word:')

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


You shoul define the list "word" as empty before your code;

word = []

That'd be enough. :smile:


As you can easily see from your if/else statement you never actually define word because if there is data in your original then it will always pass thus skipping the assignment step.