Answers for "How to return a new string with its first and last characters swapped"

0

How to return a new string with its first and last characters swapped

>>> temp = "abcde"
>>> temp[1:-1]
'bcd'
>>> temp[-1:] + temp[1:-1] + temp[:1]
'ebcda'
>>>
Posted by: Guest on February-26-2021

Code answers related to "How to return a new string with its first and last characters swapped"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language