Tells you what is Zen of Python

Actually this is enough to print the Truth:

import this

Loop version from

result = []
for c in this.s: ## fixed tonyjv
   if c in this.d:
print "".join(result)

Edited 6 Years Ago by pyTony: Added uncomprehension version

import this
whatiszenofpython= "".join([c in this.d and this.d[c] or c for c in this.s])

IT/Science/Contracts/Religious translation/interpreting FIN-ENG-FIN
Python programming

Did my own version (generator and string concatenation):

import this ## prints zenofpython
print '-'*70
whatiszenofpython = "".join(this.d[c] if c in this.d else c for c in this.s)
zen = ''
for c in this.s:
    zen += this.d[c] if c in this.d else c
print zen

Edited 6 Years Ago by pyTony: n/a

It is same as mine.. But I produce default value with logical operations or if..else instead of using default parameter of get. It is handy to remember the get alternative, of course.

Edited 6 Years Ago by pyTony: n/a

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.