Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
isinstance solution in Clear category for Sum by Type by Vealo
from typing import Tuple
def sum_by_types(items: list) -> Tuple[str, int]:
return ("".join([x for x in items if isinstance(x, str)]), sum([x for x in items if isinstance(x, int)]))
April 19, 2021
Comments: