Last active
September 17, 2023 15:30
-
-
Save twitu/f958152b63971b319a4a0782285d9901 to your computer and use it in GitHub Desktop.
Pop those crackles
This file contains hidden or 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
# Crackle pop game for numbers | |
# Print Crackle for multiple of 3 | |
# Print Pop for multiple of 5 | |
# Print CracklePop if multiple of both | |
# Print the number if not multiple of either | |
def cracklepop(n): | |
for i in range(1, n + 1): | |
if i % 3 == 0 and i % 5 == 0: | |
print("CracklePop") | |
elif i % 3 == 0: | |
print("Crackle") | |
elif i % 5 == 0: | |
print("Pop") | |
else: | |
print(i) | |
if __name__ == "__main__": | |
cracklepop(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment