Как изменить строку в Python
# in order to make a string reversed in python
# you have to use the slicing as following
string = "racecar"
print(string[::-1])
Tejas Naik
# in order to make a string reversed in python
# you have to use the slicing as following
string = "racecar"
print(string[::-1])
def reverse(text):
reversed = ''
for i in range(len(text)-1, -1, -1):
reversed += text[i]
return reversed
print("reverse({}): {}".format("abcd", reverse("abcd")))