There is no built in reverse function for Python\'s str object. What is the best way of implementing this method?
reverse
str
If supplying a very conci
def reverse_string(string): length = len(string) temp = '' for i in range(length): temp += string[length - i - 1] return temp print(reverse_string('foo')) #prints "oof"
This works by looping through a string and assigning its values in reverse order to another string.