Skip to content

Instantly share code, notes, and snippets.

@shabda
Created November 14, 2014 11:51
Show Gist options
  • Save shabda/323ba63e5bf460a85cc2 to your computer and use it in GitHub Desktop.
Save shabda/323ba63e5bf460a85cc2 to your computer and use it in GitHub Desktop.
import functools
h = 100
b = range
r = functools.partial(b, 0)
yz = lambda y, z: dict(zip(r(h, y), [z]*h))
a = dict(zip(b(100), b(100)))
a.update(yz(3, "F"))
a.update(yz(5, "B"))
a.update(yz(15, "FB"))
print a.values()[1:]
w={};r=range;h=101
for i in r(3,h,3):w[i]="Fizz";
for i in r(5,h,5): w[i]="Buzz"
for i in r(15,h,15):w[i]="FizzBuzz"
for i in r(1,h):print(w.get(i,i))
p={}
r=range
h=101
f="Fizz"
b="Buzz"
w=lambda X,Y:p.update(dict(zip(r(Y,h,Y),[X]*h)))
w(f,3);w(b,5);w(f+b,15)
for i in r(1,h):print(p.get(i,i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment