Python Program to Reverse a String
In this python program, we will learn how to reverse a string in python. Implementation: def reverse(string):
reversed_string = ""
for i in string:
reversed_string = i+reversed_string
print("reversed string is:",reversed_string)
string = input("enter a string:")
print("entered string",string)
reverse(string) Output:
enter a string: programmersdoor
entered string programmersdoor
reversed string is: roodsremmargorp Happy Coding! Follow us on Instagram @programmersdoor Join us on Telegram @programmersdoor Please write comments if you find any bug in the above code/algorithm, or find other ways to solve the same problem. Follow Programmers Door for more. #blog #interview #placement #learn #computer #science
