Returns the reverse of a string.
Use string slicing to reverse the string.
代码实现
def reverse_string(s):
return s[::-1]
使用样例
reverse_string("snippet") #"teppins"
Returns the reverse of a string.
Use string slicing to reverse the string.
def reverse_string(s):
return s[::-1]
reverse_string("snippet") #"teppins"