Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
229 B
0
Indexable
Never
def sum_by_types(a: list) -> (str, int):
    accum = {T: T() for T in (str, int)}
    print(accum)
    for i in a:
        accum[type(i)] += i
    return accum.values()

#
print(list(sum_by_types(["1", 'ss', 2, 3])))
#