Skip to content

Instantly share code, notes, and snippets.

@shiumachi
Created August 24, 2013 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiumachi/6328367 to your computer and use it in GitHub Desktop.
Save shiumachi/6328367 to your computer and use it in GitHub Desktop.
FizzBuzz, lambda 版
def function_fizbuzz(x):
fizz = lambda x: x[1](x[0])
buzz = lambda x: (x, lambda y: "fizzbuzz" if y % 3 == 0 else "buzz") if x % 5 == 0 else (x, lambda y: "fizz" if y % 3 == 0 else y)
return fizz(buzz(x))
[print(function_fizbuzz(x)) for x in xrange(1,100)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment