Skip to content

Instantly share code, notes, and snippets.

@kahunacohen
Created March 13, 2023 10:02
Show Gist options
  • Save kahunacohen/497e81cdbfd830755921713558eaa402 to your computer and use it in GitHub Desktop.
Save kahunacohen/497e81cdbfd830755921713558eaa402 to your computer and use it in GitHub Desktop.
'''
Fizz buzz in Python:
Any number divisible by three print the word fizz and any number divisible by five print the word buzz.
Numbers divisible by both three and five become fizz buzz.
'''
for n in [n + 1 for n in range(100)]:
if n % 15 == 0:
print("fizz buzz")
if n % 3 == 0:
print ("fizz")
elif n % 5 == 0:
print("fuzz")
else:
print(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment