Created
May 25, 2019 12:04
-
-
Save freundTech/e4c9bd665fd7625790429ae3532112d9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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