Skip to content

Instantly share code, notes, and snippets.

@amaciel81
Created September 15, 2018 23:31
Show Gist options
  • Save amaciel81/274548f616fff1f4573c6bdca41618de to your computer and use it in GitHub Desktop.
Save amaciel81/274548f616fff1f4573c6bdca41618de to your computer and use it in GitHub Desktop.
string1 = "Hello World!"
string2 = "I'm too odd for this s#!t"
def reverse_string(string):
string = list(string)
for i in range(0, len(string)//2):
string[i], string[-(i+1)] = string[-(i+1)], string[i]
return "".join(string)
print(reverse_string(string1))
print(reverse_string(string2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment