1# in order to make a string reversed in python
2# you have to use the slicing as following
3
4string = "racecar"
5print(string[::-1])
6
1string = 'hello people of india'
2words = string.split() #converts string into list
3print(words[::-1])
1#linear
2
3def reverse(s):
4 str = ""
5 for i in s:
6 str = i + str
7 return str
8
9#splicing
10'hello world'[::-1]
11
12#reversed & join
13def reverse(string):
14 string = "".join(reversed(string))
15 return string
16
17
18