I need a simple and effective algorithm to reverse a string (for example: WelCome to emoCleW ).
I tried a loop:
s=input("Enter String To Be Reversed:")
for i in range(len(s)+1,-1,-1):
print(str1[0:i])
but this didn't work for me
I need a simple and effective algorithm to reverse a string (for example: WelCome to emoCleW ).
I tried a loop:
s=input("Enter String To Be Reversed:")
for i in range(len(s)+1,-1,-1):
print(str1[0:i])
but this didn't work for me
Like this:
s=input("Enter String To Be Reversed:")
print(s[::-1])