Source Code:
(back to article)
def reverse_string(string): if len(string) == 0: return string else: return reverse_string(string[1:]) + string[0] string = "hello" reversed_string = reverse_string(string) print(reversed_string) # Output: "olleh"
Result:
Report an issue