Python 'Ending Up' Help


#1

I was wondering if somebody could help me with my code. I'm not quite sure what it is I am doing wrong. Thanks in advance!

pyg = 'ay'

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

#2

Ok, first, I would put everything under the if statement after original = raw_input('Enter a word:') and keep print original right after print original. Secondly, you have combined what your new_word needs to be equal to in two lines to one and that will not work for this. You need to have new_word equal to word + first + pyg and new_word = something[1:len.(new_word)]. Then you need to print something again. All in all, here is a basic outline:

original = raw_input('Enter a word:')

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

#3

This was so incredibly helpful. Thank you for clarifying. Going from one lesson to the next, the logical flow is easy to jumble. You did a good job of bringing that back in. :slight_smile:


#4

Thanks man! Appreciate it! :smiley:


#5

Thanks so much!!! Really helped me


#6

Thank you soooooo much


#7

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