i have used modulo and division to get the sum but the output gives an error. The error says "Did you create a function called digit_sum? Your code threw a "local variable 'sum' referenced before assignment" error.
Add your code here, between the ```'s! def digit_sum(n): while n > 0: sum = 0 sum = sum + n %10 n = n / 10 return sum