Last active
August 29, 2019 15:28
-
-
Save ilyannn/ce9928b0b2b357d0fb831591e35ee16d to your computer and use it in GitHub Desktop.
Almost one-liner fold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fold(s, p = 0): | |
for i in [i+1 for (i, c), n in zip(enumerate(s), s[1:]+' ') if c != n]: p = print(s[p], i-p, sep="", end="") or i |
Author
ilyannn
commented
Aug 29, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment