diff --git a/challenges/Python/reversingstring/revstring.py b/challenges/Python/reversingstring/revstring.py new file mode 100644 index 0000000..7ebb31f --- /dev/null +++ b/challenges/Python/reversingstring/revstring.py @@ -0,0 +1,14 @@ +#Python 3 code to reverse a string +def reverse(s): + str = "" + for i in s: + str = i + str + return str + +s= str(input("Enter the string to be reversed \n")) + +print("The original string is : ", end="") +print(s) + +print("The reversed string(using loops) is : ", end="") +print(reverse(s)) \ No newline at end of file