Skip to content

Instantly share code, notes, and snippets.

@freundTech
Created May 25, 2019 12:04
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 freundTech/e4c9bd665fd7625790429ae3532112d9 to your computer and use it in GitHub Desktop.
Save freundTech/e4c9bd665fd7625790429ae3532112d9 to your computer and use it in GitHub Desktop.
import sys
import random
def main():
text = sys.argv
output = [shuffle(x) for x in text[1:]]
print(" ".join(output))
def shuffle(word):
if len(word) <= 3:
return word
inner = list(word[1:-1])
random.shuffle(inner)
return "".join(list(word[0]) + inner + list(word[-1]))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment