Having Issues in "Ending Up"


#1

I can change the code to print the translation accurately but it says "Oops, try again. It looks like you printed the correct translation of "penisss", but make sure to set new_word equal to the slice as well.". Anyone have a similar issue?


#2

@javarockstar15176,

From
https://docs.python.org/2/tutorial/introduction.html#strings
[quote]
Strings can be indexed (subscripted), with the first character having index 0. There is no separate character type; a character is simply a string of size one:

word = 'Python'
word[0] # character in position 0
'P'
word[5] # character in position 5
'n'

Indices may also be negative numbers, to start counting from the right:

word[-1] # last character
'n'
word[-2] # second-last character
'o'
word[-6]
'P'

Note that since -0 is the same as 0, negative indices start from -1.

In addition to indexing, slicing is also supported. While indexing is used to obtain individual characters, slicing allows you to obtain a substring:

word[0:2] # characters from position 0 (included) to 2 (excluded)
'Py'
word[2:5] # characters from position 2 (included) to 5 (excluded)
'tho'

Note how the start is always included, and the end always excluded. This makes sure that s[:i] + s[i:] is always equal to s:

[end-quote]