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)
Answer =
string = input("Enter a string :-") new_str = string[-1] + string[1:-1] + string[0] print(new_str)
Helped a lot
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )