blog.raek.se

My First Quine

This program (written in Python 3) is a Quine, a self-reproducing program. Run it with python3 and watch it output its own code!

program_part = [
93, 10, 35, 32, 84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 99, 117, 116, 101, 32, 112, 114, 111, 103, 114, 97, 109, 32, 116, 104, 97, 116, 32, 114, 101, 112, 114, 111, 100, 117, 99, 101, 115, 32, 105, 116, 115, 101, 108, 102, 46, 46, 46, 10, 112, 114, 105, 110, 116, 40, 34, 112, 114, 111, 103, 114, 97, 109, 95, 112, 97, 114, 116, 32, 61, 32, 91, 34, 41, 10, 112, 114, 105, 110, 116, 40, 34, 44, 32, 34, 46, 106, 111, 105, 110, 40, 109, 97, 112, 40, 108, 97, 109, 98, 100, 97, 32, 120, 58, 32, 115, 116, 114, 40, 120, 41, 44, 32, 112, 114, 111, 103, 114, 97, 109, 95, 112, 97, 114, 116, 41, 41, 41, 10, 112, 114, 105, 110, 116, 40, 34, 34, 46, 106, 111, 105, 110, 40, 109, 97, 112, 40, 108, 97, 109, 98, 100, 97, 32, 120, 58, 32, 99, 104, 114, 40, 120, 41, 44, 32, 112, 114, 111, 103, 114, 97, 109, 95, 112, 97, 114, 116, 41, 41, 44, 32, 101, 110, 100, 61, 34, 34, 41
]
# This is a cute program that reproduces itself...
print("program_part = [")
print(", ".join(map(lambda x: str(x), program_part)))
print("".join(map(lambda x: chr(x), program_part)), end="")

Comments

Guest commenting is enabled. Registration is not required.