Take a look at the python code below. Which segment of code should be replaced in place of the first line(
) so that the when the code runs, it prints
exactly
itself ?
1 2 3 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The answer is
Pieces of code that do this are called Quines. Take a look at the wikipedia page for more.
Also in the 'see also' section of the page there is another interesting page on Tupper's self-referential formula
which graphs itself when plotted