Skip to content

Instantly share code, notes, and snippets.

@raol
Last active December 23, 2015 23:39
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 raol/6711904 to your computer and use it in GitHub Desktop.
Save raol/6711904 to your computer and use it in GitHub Desktop.
sort = sorted(values)
final = []
current = [sort[0]]
for i in range(1, len(sort)):
if sort[i] == sort[i - 1] + 1:
current.append(sort[i])
else:
final.append(current)
current = [sort[i]]
final.append(current)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment