Last active
September 14, 2017 00:59
-
-
Save reikoNeko/b30d671f6f167ec06086d6208e5b2e93 to your computer and use it in GitHub Desktop.
A clear but not fully pythonic fizzbuzz implementation
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
def fizzbuzz(n): | |
for x in range(1,n+1): | |
result='' | |
if not x%3: result += ('fizz') | |
if not x%5: result += ('buzz') | |
yield result if result else str(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In production I'd cheat more and also consider memoization. :)