Skip to content

Instantly share code, notes, and snippets.

@theoremoon
Last active April 14, 2016 13:57
Show Gist options
  • Select an option

  • Save theoremoon/76341aef8c8432d708b9cdf341f4270b to your computer and use it in GitHub Desktop.

Select an option

Save theoremoon/76341aef8c8432d708b9cdf341f4270b to your computer and use it in GitHub Desktop.
def FizzBuzz(n):
if n == 0:
return str(0)
elif n % 15 == 0:
return "FizzBuzz"
elif n % 3 == 0:
return "Fizz"
elif n % 5 == 0:
return "Buzz"
return str(n)
n = int(input())
print(" ".join([FizzBuzz(i) for i in range(n + 1)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment