Skip to content

Instantly share code, notes, and snippets.

@pcote
Created January 1, 2016 15:54
Show Gist options
  • Select an option

  • Save pcote/451f3bda54ca9b3afc20 to your computer and use it in GitHub Desktop.

Select an option

Save pcote/451f3bda54ca9b3afc20 to your computer and use it in GitHub Desktop.
def fizzbuzz2(max_num):
for num in range(1, max_num+1):
fizz = "fizz" if num % 3 == 0 else ""
buzz = "buzz" if num % 5 == 0 else ""
print("{}: {}".format(num, fizz + buzz))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment