This code works correctly. I ask of the hive's collective knowledge: how could this code be more efficient? Are there "smarter" approaches to reversing a string?
Thank you in advance.
def reverse(text): count = 1 while (len(text) - count) >= 0: result = "" for i in text: result += text[(len(text) - count)] count += 1 if len(result) == len(text): return result print reverse("fart")