Move it on back


#1

I don't understand the following:

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

What is the new_word variable supposed to concatenate?


#2

Your post does not appear to be formatted correctly, for everyone's sake, please ensure that any code that you post is intact and can be copied and run without any modification to reproduce what you are having a problem with.

If "pony" is entered, then you should pick out the parts "p", "ony" and "ay" and then concatenate those together into a single string.


#3

Set this variable at the top (it was missing in your code):

pyg = 'ay'

new_word concatenates the lower case version of user input + the first letter of that word + "ay"

so if user had entered "Table" it would have returned "tabletay"

then you have to slice off the first letter before printing by re-setting the variable:

new_word = new_word[1:]

Hope that helps

p.s. move the IF statement right after user input line and put the rest of your code between that and ELSE
also you do not need "print first" you want to "print new_word"