Narcissist: Difference between revisions

Content added Content deleted
m (added whitespace before the TOC (table of contents), added other whitespace to the task's preamble.)
(→‎{{header|Python}}: Fixed Python 3)
Line 274: Line 274:


=={{header|Python}}==
=={{header|Python}}==
For Python 2.x:
{{Works with|Python|2}}
<lang Python>
<lang Python>
import sys
import sys
Line 285: Line 285:
</lang>
</lang>


{{Works with|Python|3}}
A shorter one for python 3: (change the input to raw_input for python 2)

<lang Python>
<lang Python>
_='_=%r;print _%%_==input()';print _%_==input()
_='_=%r;print (_%%_==input())';print (_%_==input())
</lang>
</lang>