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

>>>


2 Comments

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

  1. hey path walla why no new questions yet

    ReplyDelete
  2. just a request please take u r time to publish

    ReplyDelete

Post a Comment

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

Previous Post Next Post