Musings of a programmer, musician, photographer, and Christian.

Jan 23, 2015 - 1 minute read - Comments - programming python

Python Fun - onliners

I’ve not done a ton of programming in Python for a while, but I still do like the language. I also like trying to do things in one line (ok, one statement), just because it’s a bit more difficult :). These are pretty old, but I used to keep these in my email signature line…

Mandlebrot set

#this one really only works if your terminal window is 80 wide
import os;map(lambda i:os.write(1,chr(reduce(lambda(z,t),o:abs(z*z)>4and(6,

The screen of e

print'e=%s'%(lambda x:'%s.%s'%(x[0],x[1:-1]))(str(reduce(lambda

When is easter?

print(lambda(m,d):'%s %s'%({3:'March',4:'April'}[m],d))((lambda(m,d):(m
==3and d>31)and(4,d-31)or(m,d))((lambda(m,d,y):(m,d+7-(lambda(m,d,y):(23
(p,y):(p>31)and(4,p-31,y)or(3,p,y))((lambda y:(50-((11*((y%19)+1)-y/100+

How much is your loan payment?


comments powered by Disqus