Skip to content

Instantly share code, notes, and snippets.

@vpontis
Created May 22, 2019 14:33
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 vpontis/ff92942086870c44f01383d6f044003d to your computer and use it in GitHub Desktop.
Save vpontis/ff92942086870c44f01383d6f044003d to your computer and use it in GitHub Desktop.
A Program That Prints Itself
A = [
"A = [",
"]",
"def f():",
" print(A[0])",
" for v in A:",
" print(chr(34) + v + chr(34) + ',')",
" print(A[1])",
" for v in A[2:]:",
" print(v)",
"f()",
]
def f():
print(A[0])
for v in A:
print(chr(34) + v + chr(34) + ',')
print(A[1])
for v in A[2:]:
print(v)
f()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment