Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Comprehence & isinstance solution in Clear category for Sum by Type by serp90
from typing import Tuple
def sum_by_types(items: list) -> Tuple[str, int]:
num = sum((n for n in items if isinstance(n, int)))
s = ''.join((n for n in items if isinstance(n, str)))
return (s, num)
March 28, 2021