Skip to content

Instantly share code, notes, and snippets.

@lettergram
Last active February 1, 2019 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lettergram/4bd6f589a2eb04ed3da0ad47008ed1e1 to your computer and use it in GitHub Desktop.
Save lettergram/4bd6f589a2eb04ed3da0ad47008ed1e1 to your computer and use it in GitHub Desktop.
# Python Implementation of Hello Worms
string = bytearray("Hello, Worms!", 'UTF-8')
for i in range(int(len(string) / 2)): # Cast to int for Range
temp = string[i]
string[i] = string[len(string) - i - 1] # -1 or error
string[len(string) - i - 1] = temp # add -1 or error
print(string.decode('UTF-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment