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
Here is one without [::-1] or reversed (for learning purposes):
[::-1]
reversed
def reverse(text): new_string = [] n = len(text) while (n > 0): new_string.append(text[n-1]) n -= 1 return ''.join(new_string) print reverse("abcd")
you can use += to concatenate strings but join() is faster.
+=
join()