Well done! However, now we have the first letter showing up both at the beginning and near the end.
s = "Charlie" print s # will print "C" print s[1:4] # will print "har"
- First we create a variable
sand give it the string
- Next we access the first letter of
s. Remember letter positions start at 0.
- Then we access a slice of
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.
new_word equal to the slice from the 1st index all the way to the end of
[1:len(new_word)] to do this.