Created
August 3, 2012 14:13
-
-
Save theladyjaye/3248004 to your computer and use it in GitHub Desktop.
Functional-ish fizzbuzz in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import cycle, izip | |
import operator import add | |
fizz = cycle(['', '', 'fizz']) | |
buzz = cycle(['','','','','buzz']) | |
r = izip(fizz, buzz) | |
index = 1 | |
while index < 101: | |
print("{}: {}".format(index, add(*r.next()))) | |
index = index + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here it is in Haskell