Skip to content

Instantly share code, notes, and snippets.

@pedroserrudo
Created December 30, 2014 14:38
Show Gist options
  • Save pedroserrudo/958142f52aa54a7694a1 to your computer and use it in GitHub Desktop.
Save pedroserrudo/958142f52aa54a7694a1 to your computer and use it in GitHub Desktop.
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