1func reverse(s string) string {
2 runes := []rune(s)
3 for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
4 runes[i], runes[j] = runes[j], runes[i]
5 }
6 return string(runes)
7}
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
1user_input = input("Input the sentence you want reversed: ")
2print (user_input[::-1])
3#This is the easiest way to do it lol