Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Neutraldict solution in Creative category for Sum by Type by veky
import collections, operator
class Neutral(dict): __missing__ = staticmethod(lambda T: T())
report = operator.itemgetter(str, int)
def sum_by_types(a: list) -> report:
accum = Neutral()
for elem in a: accum[type(elem)] += elem
return report(accum)
March 12, 2020
Comments: