Ending Up Exercise : Don't know what to do?


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

It says this error for some reason.

Enter a word: Hello

Oops, try again. It looks like new_word contains "y" instead of "ellohay"!

I thought adding the variables original and pyg together would combine to the entered word and "ay".

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 =  original and pyg[1:]
    print new_word

   print 'empty'


In previous ex.

We have to set new_word to sum of strings word, first and pyg
We already learnt string concatenation , right ?
We use + operator to do this.

Last part/Final exercise says this to do..

Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.

It means we have to set slice of new_word to itself again (Re-assigning).
Then we have to print new_word


new_word = original and pyg[1:]
Erase this line of code.


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