Last active
August 29, 2015 14:15
-
-
Save Craigson/f81b36d87a47365c2847 to your computer and use it in GitHub Desktop.
Code snippet for HackerSchool application - Written in Python
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
| #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