After researching, I found a one-line way to declare all variables within the function:
pyg= 'ay' original= raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): word= original.lower(); first= word; new_word= word[1:len(word)]+ first+ pyg print new_word else: print 'empty'
Also, note that
else: does not require an indented next line. Feel free to try it out. It also works for Python 3.x (you'll have to use the
input(), naturally). Hope it helps.