Created
October 26, 2019 22:04
-
-
Save wmmnola/f02de4a0de748c175785d3f6b3d7e8b2 to your computer and use it in GitHub Desktop.
A very compact and neat fizzbuzz solution
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 i in range(0, n): | |
s = "%d : " % i | |
s += "fizz" if i % 3 == 0 else "" | |
s += "buzz" if i % 5 == 0 else "" | |
print(s) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment