#443 · Math · Expert · 220 XP · about 40 min
The digit sum of a number adds up its decimal digits: the digit sum of 2026 is 2 + 0 + 2 + 6 = 10.
Write digit_sum_total(lo, hi) that returns the total of the digit sums of every whole number from lo to hi, both included.
digit_sum_total(1, 10) # returns 46 digit_sum_total(10, 12) # returns 6 digit_sum_total(5, 5) # returns 5
From 10 to 12 the digit sums are 1, 2 and 3, which make 6.
First solves only, ranked by stars and then time.