Skip to content

Instantly share code, notes, and snippets.

@rknLA
Created October 11, 2015 20:45
Show Gist options
  • Save rknLA/8b0bae3c28c49e819761 to your computer and use it in GitHub Desktop.
Save rknLA/8b0bae3c28c49e819761 to your computer and use it in GitHub Desktop.
distances = []
i = 0
while i < len(sorted_forces) — 2:
this_val = sorted_forces[i]
next_val = sorted_forces[i+1]
# ^^ this is why we use -2 instead of -1 in the while condition
distance = next_val — this_val
distances.append(distance)
i += 1
@rknLA
Copy link
Author

rknLA commented Oct 12, 2015

Thanks! I always forget about zip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment