Learn

Well done! However, now we have the first letter showing up both at the beginning and near the end.

s = "Charlie" print s[0] # will print "C" print s[1:4] # will print "har"
  1. First we create a variable s and give it the string "Charlie"
  2. Next we access the first letter of "Charlie" using s[0]. Remember letter positions start at 0.
  3. Then we access a slice of "Charlie" using s[1:4]. This returns everything from the letter at position 1 up till position 4.

We are going to slice the string just like in the 3rd example above.

Instructions

1.

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.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?