Skip to content

Instantly share code, notes, and snippets.

@Craigson
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save Craigson/f81b36d87a47365c2847 to your computer and use it in GitHub Desktop.

Select an option

Save Craigson/f81b36d87a47365c2847 to your computer and use it in GitHub Desktop.
Code snippet for HackerSchool application - Written in Python
#Written by Craig Pickard for HackerSchool Application for Summer Batch 1, 2015
#Language: Python
#This code prints out the integers 1-100 (inclusive), replacing every integer value that's divisible by 3 with the string #"Crackle", every integer that's divisible by 5 with the string "Pop", and every integer that's divisible by both 3 and 5 with
#the word "CracklePop".
snapList = []
for i in range (1,101):
if i % 3 == 0 and i % 5 == 0:
snapList.append("CracklePop")
elif i % 3 ==0:
snapList.append("Crackle")
elif i % 5 ==0:
snapList.append("Pop")
else:
snapList.append(i)
for i in snapList:
print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment