Skip to content

Instantly share code, notes, and snippets.

@gmotzespina
Created July 2, 2024 16:39
Show Gist options
  • Select an option

  • Save gmotzespina/2b65a0ec7afaeba18f4767e121430c7e to your computer and use it in GitHub Desktop.

Select an option

Save gmotzespina/2b65a0ec7afaeba18f4767e121430c7e to your computer and use it in GitHub Desktop.
String Reversal Example
def reverse_string(s):
if len(s) == 0:
return s
else:
return reverse_string(s[1:]) + s[0]
print(reverse_string("hello")) # Output: olleh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment