Q. Write a program which reverses a string and stores the reversed string in a new string.

Answer :-

string = input("Enter a string :- ")
newstring = string[-1:-len(string)-1:-1]
print(newstring)

Output :-

Enter a string :- Portal Express
sserpxE latroP

>>>


Enter a string :- Python
nohtyP

>>>


Post a Comment

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

Previous Post Next Post