Created
September 15, 2018 23:31
-
-
Save amaciel81/274548f616fff1f4573c6bdca41618de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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