10. Ending Up


#1



10. Ending up


Oops, try again. It looks like new_word contains "laylay" instead of "aylay"!


I need some help with this problem, I can't figure out what's wrong with it?

thanks for any help in advance.


Replace this line with your code. 
pyg = 'ay'
original = raw_input('Enter a word:')
toronto = raw_input
word = original.lower()
first = word[0]
new_word = word + first + pyg 
new_word [1:len(new_word)]

if len(original) > 0 and original.isalpha():
    print original
    word = original.lower()
    first = word[0]
elif len(toronto) > 0 and toronto.isalpha():
    print 'toronto 2323232'
    


else:
    print 'empty'


#2

you don't store the slice of new_word anywhere:

new_word [1:len(new_word)]

try setting new_word to a slice of new_word


#4

In your code, new_word is still word + first + pyg
In this lesson new_word has to be equal to new_word[1:len(new_word)]
Insert new_word = new_word[1:len(new_word)]
after new_word = word + first + pyg


#5

2 posts were split to a new topic: 10. ending up


#6

pyg = 'ay'

original = raw_input('Enter a word:')

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

else:

print 'empty'

I think this is the right answer


#7

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