What is wrong with this code?


pyg = 'ay'

original = raw_input('Enter a word:')

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

    print 'empty'


When you test your code are the results you get correct?


in your case
new_word = python + p + ay i.e pythonpay and you are printing the original word instead of the new word.
just check out the below code
new_word= word[1:] + first + pyg
print new_word


Please be sure to explain your code snippet.


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