Created
April 21, 2022 13:18
-
-
Save mgill25/be0666c7163a6a0fe283f03c2afd16af to your computer and use it in GitHub Desktop.
Crackle Pop
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 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