Skip to content

Instantly share code, notes, and snippets.

@massenz
Created March 26, 2022 08:02
Show Gist options
  • Save massenz/9c79da4a38b8715549585b8ff723b373 to your computer and use it in GitHub Desktop.
Save massenz/9c79da4a38b8715549585b8ff723b373 to your computer and use it in GitHub Desktop.
FizzBuzz in less than 5 minutes, as described at http://codetrips.com
#!/usr/bin/env python
#
# FizzBuzz -- created by M. Massenzio, 2022-03-26
import sys
n = sys.argv[1]
for i in range(3, int(n) + 1):
out = ""
if i % 3 == 0:
out = "Fizz"
if i % 5 == 0:
out += "Buzz"
if out != "":
print(f"{i}: {out}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment