Ad

Write a function that adds the digits of an integer. For example, the input receives a number: 10023. The result should be - 6 (1 + 0 + 0 + 2 + 3).

def digit_sum(number: int) -> int:
    return(sum([int(num) for num in str(abs(number))]))