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?
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 # character in position 0
word # character in position 5
Indices may also be negative numbers, to start counting from the right:
word[-1] # last character
word[-2] # second-last character
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)
word[2:5] # characters from position 2 (included) to 5 (excluded)
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: