Ending Up Section ("New_word equal to the slice"?)


Hi I'm in teh "Ending Up" section.

I receive an error, "Oops, try again. It looks like you printed the correct translation of "worm", but make sure to set new_word equal to the slice as well."

Not exactly sure what the bolded words mean...



It just means that you need to set new_word equal to new_word[1:len(new_word)] as stated in the instructions (below new_word = word + first + pyg).
You don't need to create a new variable, s so you can remove it.
And then just print new_word.

[1:len(new_word)] is an example of a slice. You'll come across it later in the lessons.


My code is not working at all, yet Academy says I passed it???


It's best to create another discussion and post your code (formatted is preferred) :slight_smile:


Thank you @datfatcat

I redid the new_word and got rid of the "s" variable...
I receive an error message.
I thought the lines give below give the instruction of "slicing the first letter" via these lines, correct?

new_word = word + first + pyg
new_word == new_word[1:len(new_word)]


Maybe I was being a little confusing with "equal". Sorry about that! I meant assigning new_word to new_word[(1:len(new_word)] after new_word = word + first + pyg

new_word = word + first + pyg 
new_word = new_word[1:len(new_word)]

== is mostly used for conditional statements (eg.if 4 == 4 => True).


Thanks @datfatcat

Got it!
Thank you --and thank your for telling me that == is used mostly for conditional statements!

appreciate you


I'm getting the same error message but i seem to have gone about my code slightly differently:

I'm not sure where i'm going wrong, and also don't follow why you'd need to assign new_word = word + first + pyg ?

Any help would be much appreciated!


I had the same exact problem and this discussion goes over it very well. I would check this out if anyone has problems with the question that was posed by this topic.


Because your previous lesson, 9.Move it on Back, tells you to set new_word = word + first + pyg?

The final output is to have your first letter after the other letters and before the pyg.
So, you made a variable specifically for your first letter, first = word[0].
Now, you have to put that in new_word = word + first + pyg.

Let's say your word you inputted was "cat", the console will print catcay. The last step is to remove that first letter so it prints atcay which is the desired output according to the lesson.

In order to do that, you will create a slice, new_word = new_word[1:len(new_word)] after new_word = word + first + pyg. This slice tells the program to start from index 1 of the new word all the way to the end. Note: The first letter is at index 0. And that's how you get atcay.


Ahh of course it did! Thanks very much!

Also very well explained :+1:


pyg = 'ay'
new_word = 'word + first + pyg'
print str(3)
word = 'Original'.lower()

if Original.lower()

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

Oops, try again. new_word should be a string!

I am experiencing the same problem, i just don't know where i am going wring..anyone to help me out?


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