Help me! (Ending UP)


#1



https://www.codecademy.com/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096#


Oops, try again. It looks like new_word contains "dodday" instead of "odday"!


I inserted dodo and I expected ododay to show, i am aware i didnt change anything, but i need help (pls no anwsers)


pyg = 'ay'

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 original
else:
    print 'empty'


#2

Instead of setting new_word to word+first+pyg try setting it to [1:len(new_word)] + first + pyg, like the lesson's instructions say. :slight_smile:


#3

Your variables should go right after if statement.if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = word[1:len(new_word)] + first + pyg
print new_word


#4

Thank You! I just double checked it! and it was a silly mistake... by the way, are there tutorials for Python 3x, In codeacademy?


#5

Hello,

May I ask why you don't use a 's' like below?


s[1:len(new_word)]


#6

We do, it should be word[1:]+first+pyg, something I may have omitted in my original post. Instead of s we use word, the string being spliced.


#7

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