Skip to content

Instantly share code, notes, and snippets.

@jhazelwo
Created August 1, 2017 02:03
Show Gist options
  • Save jhazelwo/f2afd0ddb69d6e129941376b428bd646 to your computer and use it in GitHub Desktop.
Save jhazelwo/f2afd0ddb69d6e129941376b428bd646 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
def is_factor_of(number, factor):
if number % factor == 0:
return True
return False
def fizzbuzz(i):
fizz = 3
buzz = 5
if is_factor_of(i, fizz) and is_factor_of(i, buzz):
return 'fizzbuzz'
if is_factor_of(i, fizz):
return 'fizz'
if is_factor_of(i, buzz):
return 'buzz'
return str(i)
for i in range(1,101):
print(fizzbuzz(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment