What are strings and how to reverse a string?
The string is an immutable sequence data type. It is a sequence of Unicode characters wrapped inside a single, double or triple quote. The task is to write a program to reverse the given string.
Example :
- Input : Hello world
- Output: dlrow olleH
s=input()
s1=””
for i in s:
s1=i+s1
print(s1)
string = ‘123456789’
output = ”
for i in range(1, len(string) + 1):
output += string[i * -1]
print(output)