Created
March 13, 2023 10:02
-
-
Save kahunacohen/497e81cdbfd830755921713558eaa402 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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