simple octagon tesselation by Sasa

a=input()
s=3*a-2
t=9*a-5
k=['']*t
p=" "
u="e=p*s+'#  '*c+'#';"
for i in range(t/2+1):c=a+2*min(a-1,i/3);exec("e=p*(s-1)+' ##'*c;s-=1",u,u"s=(1,s-2)[s>0]")[i%3];k[i]=k[t-i-1]=e
print'\n'.join(k)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top