Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Last active December 2, 2017 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacoelho/e237948e010829def9e64443472e32a2 to your computer and use it in GitHub Desktop.
Save jacoelho/e237948e010829def9e64443472e32a2 to your computer and use it in GitHub Desktop.
advent 2017 day
def transform(input):
return [int(x) for x in input]
def consecutive(L):
for prev, n in zip(L, L[1:] + L[:1]):
if prev == n:
yield n
for v in [ "1122", "1111", "1234", "91212129"]:
print(sum(transform(consecutive(v))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment