Created
December 30, 2014 14:38
-
-
Save pedroserrudo/958142f52aa54a7694a1 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
class cracklepop: | |
def __init__(self,min=1, max=10, crackle=3, pop=5): | |
print "Lets play the Crackle(%s)Pop(%s) Game between %s and %s" \ | |
% (crackle,pop,min,max) | |
self.range = range(min, max+1) | |
self.crackle = crackle | |
self.pop = pop | |
def run(self): | |
for x in self.range: | |
msg = "" | |
cracklepop = False | |
if x % self.crackle == 0: | |
msg += "Crackle" | |
cracklepop = True | |
if x % self.pop == 0: | |
msg += "Pop" | |
cracklepop = True | |
if not cracklepop: | |
msg = x | |
print msg | |
c = cracklepop(1,100) | |
c.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment