Skip to content

Instantly share code, notes, and snippets.

@mgill25
Created April 21, 2022 13:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mgill25/be0666c7163a6a0fe283f03c2afd16af to your computer and use it in GitHub Desktop.
Crackle Pop
def gen_pop(limit):
for num in range(1, limit):
if num % 3 == 0 and num % 5 == 0:
yield "CracklePop"
elif num % 3 == 0:
yield "Crackle"
elif num % 5 == 0:
yield "Pop"
else:
yield num
for num in gen_pop(101):
print(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment