Skip to content

Instantly share code, notes, and snippets.

@Mec-iS
Last active February 9, 2016 01:52
Show Gist options
  • Save Mec-iS/0fbf53b93b2693c60654 to your computer and use it in GitHub Desktop.
Save Mec-iS/0fbf53b93b2693c60654 to your computer and use it in GitHub Desktop.
# python3.5
p = {3: 'Crackle', 5: 'Pop'}
for i in range(1, 101):
try:
lst = [p.get(k) for k in p.keys() if i % k == 0]
el, length = lst[0], len(lst)
print({1: el, 2: 'CracklePop'}.get(length))
except IndexError:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment