Your question is Sum of Digits Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
WebMD may need to derive a simple numeric checksum from an integer, such as a compact value associated with a health content identifier. Given an integer, return the sum of the digits in its absolute value.
Do not convert the number to a string. Use arithmetic operations to extract each digit.
Implement sum_digits(number), where number is an integer. Return an integer equal to the sum of all decimal digits in abs(number). For example, the digit sum of -508 is 5 + 0 + 8 = 13.
A value of 0 has a digit sum of 0.
def sum_digits(number):