Can someone help me out and explain why my code wouldn’t be a solution to this exercise? See below. I am pretty sure the issue is with the calculations within the for loop. I’m also not positive if I converted the number as a string and integer correctly to get the sum. Any help is really appreciated. Thanks.
def digit_sum(n): total = 0 numstring = str(n) for digits in numstring: total += int(digits) return total