Why do i keep getting an error which says did you create the new_word variable?


#1



pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()


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


#2

A lot is mixed up here.

Your else loop shouldn't have anything but:

else:
    print 'empty'

Re-write code, especially the if block.


#3

thanks mate, it was a mistake on my part with the indentation


#4

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