Created
October 16, 2016 17:24
-
-
Save podhmo/d7db336767b57fe9d249c80f88356405 to your computer and use it in GitHub Desktop.
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
import itertools | |
def fizzbuzz(begin, end): | |
xs = [lambda i: print(i) for _ in range(15)] | |
xs[3 - 1] = lambda i: print("fizz") | |
xs[5 - 1] = lambda i: print("buzz") | |
xs[15 - 1] = lambda i: print("fizzbuzz") | |
it = itertools.cycle(xs) | |
for i in range(begin, end + 1): | |
next(it)(i) | |
if __name__ == "__main__": | |
fizzbuzz(1, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment