Created
February 1, 2017 02:12
-
-
Save shamikalashawn/0e1c874a43f60387287991b6313d5fb0 to your computer and use it in GitHub Desktop.
From the Recurse Center application, a code the prints out the first 100 natural numbers (excluding zero). If a number is divisible by 3, 'Crackle' is printed instead of the number. If it's divisible by 5, 'Pop' is printed instead. And if it is divisible by 3 and 5, then 'CracklePop' is printed.
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
for number in range (1, 101): | |
if number % 3 == 0 and number % 5 == 0: | |
print ('CracklePop') | |
elif number % 3 == 0: | |
print ('Crackle') | |
elif number % 5 == 0: | |
print ('Pop') | |
else: | |
print (number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment