Question Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string length will be at least 2.
This is what I did, but it didn't return true on every case.
def extra_end(str):
return str[2:]*3
So I checked the solution and found this answer:
def extra_end(str):
return str[-2:]*3
My question is what's the difference between [-2:]
and [2:]
?