Python quine without %r and %s

224 Views Asked by At

I know of the shortest Python quine (shortest python quine?) but it looks like a winner of a Python obfuscation challenge. It is cryptic.

Is there a Python quine that is easy to understand for a beginner: with variables, IFs, loops, but that doesnot rely on special exotic features of Python? The one that you don't "just memorize, consider it a password", but you can actually derive?


One can use any tools from a typical "Python. One hour crash course". Nope, %s and %r doesnot belong there. While my_string.replace("foo","bar") does.

1

There are 1 best solutions below

0
Alex Lancaster On

This solution abuses how lists are printed

s = ["print('s =', s, ';', s[0])"] ; print('s =', s, ';', s[0])