Last active
April 30, 2019 18:40
-
-
Save EllySmore/5350b026eb70d206dfdf6bb4e20267f2 to your computer and use it in GitHub Desktop.
Recurse Center CracklePop
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
# Write 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. You can use any language. | |
for i in xrange(1, 101): | |
if all([i%5 == 0, i%3 == 0]): | |
print (i, "CracklePop") | |
elif i%3 == 0: | |
print (i, "Crackle") | |
elif i%5 == 0: | |
print (i, "Pop") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment