Created
October 13, 2021 18:22
-
-
Save fjsj/3097351f87cbeaab50ab9b00d9d163ab to your computer and use it in GitHub Desktop.
Infinite Monkey in Python
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 random | |
import sys | |
keyboard = "0123456789abcdefghijklmnopqrstuvwxyz!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ " | |
if __name__ == "__main__": | |
expected = " ".join(sys.argv[1:]).lower() | |
already_produced_set = set() | |
produced = "" | |
while expected != produced: | |
produced = "".join(random.choice(keyboard) for __ in expected) | |
if produced not in already_produced_set: | |
already_produced_set.add(produced) | |
print("π΅ " + produced) | |
print("πππ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment