Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
[Split Pairs Using Itertools Batched Method] [Simple and Educational Solution] solution in Clear category for Split Pairs by sanddro
from typing import Iterable
from itertools import batched
def split_pairs(text: str) -> Iterable[str]:
return map("".join, batched(text + "_" if len(text) % 2 else text, 2))
March 9, 2025
Comments: