Change first and last letter of a string

x = input(“enter any string”)
n = x[0]
b =x[-1]
c= x[1:-1]
v = b + c + n
print(v)

i try to change the first and the last letter of a string

Is that program is correct ?

Mey you tell me?

Hi Nirav,

Great work. Your program is almost correct, but there is a small issue: it does not handle edge cases properly (like single-character strings or empty strings).