Skip to content

Instantly share code, notes, and snippets.

@joaorafaelm
Created April 16, 2016 23:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaorafaelm/600098612e16875853287ab3745f301b to your computer and use it in GitHub Desktop.
Save joaorafaelm/600098612e16875853287ab3745f301b to your computer and use it in GitHub Desktop.
Crackle pop in python
"""
A program that prints out the numbers 1 to 100 (inclusive).
If the number is divisible by 3, print Crackle instead of the number.
If it's divisible by 5, print Pop.
If it's divisible by both 3 and 5, print CracklePop.
"""
for number in range(1, 101):
if number % 15 == 0:
print ("CracklePop")
continue
elif number % 3 == 0:
print ("Crackle")
continue
elif number % 5 == 0:
print ("Pop")
continue
else: print(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment