Q. Write a Python program to change a given string to a new string where the first and last chars have been exchanged.

 

Answer = 

 



string = input("Enter a string :-")
new_str = string[-1] + string[1:-1] + string[0]
print(new_str)

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post