Skip to content

Instantly share code, notes, and snippets.

@whardier
Created November 15, 2011 20:36
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 whardier/1368255 to your computer and use it in GitHub Desktop.
Save whardier/1368255 to your computer and use it in GitHub Desktop.
>>> num = "15558675309"
>>> [num[0:x] for x in range(1, len(num))]
['1', '15', '155', '1555', '15558', '155586', '1555867', '15558675', '155586753', '1555867530']
>>> [num[x:] for x in range(1, len(num))]
['5558675309', '558675309', '58675309', '8675309', '675309', '75309', '5309', '309', '09', '9']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment