Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created February 1, 2017 02:12
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 shamikalashawn/0e1c874a43f60387287991b6313d5fb0 to your computer and use it in GitHub Desktop.
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.
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