Skip to content

Instantly share code, notes, and snippets.

@chomy
Last active December 21, 2015 16:09
Show Gist options
  • Save chomy/6332061 to your computer and use it in GitHub Desktop.
Save chomy/6332061 to your computer and use it in GitHub Desktop.
FizzBuzz code use only lambda.
#!/usr/bin/python
buzz = lambda x:[(lambda _x: "" if _x%5 else "Buzz")(x), x]
fizz = lambda x: (x[0] if x[0]=='Buzz' else x[1]) if x[1]%3 else "Fizz" + x[0]
for i in range(1,100):
print fizz(buzz(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment