Skip to content

Instantly share code, notes, and snippets.

@wmmnola
Created October 26, 2019 22:04
Show Gist options
  • Save wmmnola/f02de4a0de748c175785d3f6b3d7e8b2 to your computer and use it in GitHub Desktop.
Save wmmnola/f02de4a0de748c175785d3f6b3d7e8b2 to your computer and use it in GitHub Desktop.
A very compact and neat fizzbuzz solution
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