Skip to content

Instantly share code, notes, and snippets.

@phelrine
Created January 18, 2012 06:29
Show Gist options
  • Save phelrine/1631445 to your computer and use it in GitHub Desktop.
Save phelrine/1631445 to your computer and use it in GitHub Desktop.
fizz buzz
#!/usr/bin/env python
import sys
from itertools import count, cycle, izip, imap
map(sys.stdout.write, ((str(n), "Fizz", "Buzz", "FizzBuzz")[f] + "\n" for n, f in izip(count(1), imap(sum, izip(cycle((0, 0, 1)), cycle((0, 0, 0, 0, 2)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment