markdown guide
 

1) Converting the number to a string
2) Using itertools.groupby to group each subsequent repeating digit
3) Concatenating each grouped digit with the size of its group
4) Concatenating the whole thing to one string

In [16]: ''.join(str(len(list(group))) + digit for digit, group in itertools.groupby(str(111115)))                                                                           
Out[16]: '5115'

(I interpreted the question so that the expected output for 151 is 111511 and not 2115).

Classic DEV Post from Jun 2

Software development is a social profession

The software community has lost itself in a maze of frameworks and languages

suneelvarma profile image
i am a professional python developer

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️