Skip to content

Instantly share code, notes, and snippets.

@stpierre
Created November 16, 2012 15:42
Show Gist options
  • Save stpierre/4088324 to your computer and use it in GitHub Desktop.
Save stpierre/4088324 to your computer and use it in GitHub Desktop.
Python FizzBuzz
for n in range(1, 101):
output = []
if n % 3 == 0:
output.append("Fizz")
if n % 5 == 0:
output.append("Buzz")
if not output:
print(str(n))
else:
print("".join(output))
@josephkern
Copy link

I rather do like this implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment