Created
September 11, 2015 22:02
-
-
Save dylankb/67231917eb472784a470 to your computer and use it in GitHub Desktop.
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
def cracklePop(start,stop): | |
numberList = range(start,stop) #Initialize numberList, a list of integers from 1 - 100. | |
for num in numberList: | |
if num % 5 == 0 and num % 3 == 0: | |
mark = numberList.index(num) | |
numberList.pop(mark) | |
numberList.insert(mark,"CracklePop") | |
elif num % 3 == 0: | |
mark = numberList.index(num) | |
numberList.pop(mark) | |
numberList.insert(mark,"Crackle") | |
elif num % 5 == 0: | |
mark = numberList.index(num) | |
numberList.pop(mark) | |
numberList.insert(mark,"Pop") | |
return numberList | |
print cracklePop(1,101) #Call cracklePop function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment