Skip to content

Instantly share code, notes, and snippets.

@genghisjahn
Created February 18, 2014 03:32
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 genghisjahn/9064213 to your computer and use it in GitHub Desktop.
Save genghisjahn/9064213 to your computer and use it in GitHub Desktop.
Determines if a list of integers are seqential (n,n+1,n+2, etc..)
def _sequential_ints(self, item_vals):
prev = 0
result = False
item_vals.sort()
for i in item_vals:
if prev > 0:
if i - prev != 1:
break
prev = i
else:
result = True
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment