Created
February 5, 2018 19:23
-
-
Save ahawker/a56a9c4733d232e37f6166e0156a33c0 to your computer and use it in GitHub Desktop.
Snap, Crackle, Pop!
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
""" | |
CracklePop | |
~~~~~~~~~~ | |
A simple fizzbuzz alternative for RC. | |
Usage: `python3 cracklepop.py` | |
""" | |
import sys | |
def main(): | |
for i in range(1, 101): | |
divisible_by_3 = i % 3 == 0 | |
divisible_by_5 = i % 5 == 0 | |
if divisible_by_3 and divisible_by_5: | |
print('CracklePop') | |
elif divisible_by_3: | |
print('Crackle') | |
elif divisible_by_5: | |
print('Pop') | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment