Skip to content

Instantly share code, notes, and snippets.

@SimplyAhmazing
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimplyAhmazing/4ed8281f00525471b242 to your computer and use it in GitHub Desktop.
Save SimplyAhmazing/4ed8281f00525471b242 to your computer and use it in GitHub Desktop.
crackle_pop.py
is_crackle_worthy = lambda n: n % 3 == 0
is_pop_worthy = lambda n: n % 5 == 0
for i in range(1, 100 + 1):
should_crackle = is_crackle_worthy(i)
should_pop = is_pop_worthy(i)
if should_crackle & should_pop:
print('{:03d}.....CracklePop'.format(i))
continue
if should_crackle:
print('{:03d}.....Crackle'.format(i))
continue
if should_pop:
print('{:03d}.....Pop'.format(i))
continue
print('{:03d}.....____'.format(i))
## Example execution
## > python crackle_pop.py
# 001.....____
# 002.....____
# 003.....Crackle
# 004.....____
# 005.....Pop
# 006.....Crackle
# 007.....____
# 008.....____
# 009.....Crackle
# 010.....Pop
# 011.....____
# 012.....Crackle
# 013.....____
# 014.....____
# 015.....CracklePop
# ---- truncated ---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment