Как изменить строку в 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])
str="Python" # initial string
stringlength=len(str) # calculate length of the list
slicedString=str[stringlength::-1] # slicing
print (slicedString) # print the reversed string
txt = "Hello World"[::-1]
print(txt)
# https://www.w3schools.com/python/python_howto_reverse_string.asp
def reverse_string(str):
return str[::-1]
print(reverse_string("This string is reversed!"))
belief = "the world is mine, hello"[::-1]
print(belief)