Skip to content

Instantly share code, notes, and snippets.

@sashiyama
Created June 16, 2018 00:45
Show Gist options
  • Save sashiyama/7337ec8fba84d8ba3b1944711d0afa58 to your computer and use it in GitHub Desktop.
Save sashiyama/7337ec8fba84d8ba3b1944711d0afa58 to your computer and use it in GitHub Desktop.
FizzBuzz
def fb(n):
if n % 15 == 0:
return "FizzBuzz"
elif n % 3 == 0:
return "Fizz"
elif n % 5 == 0:
return "Buzz"
else:
return ""
i = 1
while i <= 20:
print(i, fb(i))
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment