Oops, try again. Your function fails on digit_sum(434). It returns 4 when it should return 11.
hello, i'm new to programming and just learnt a few things.
i am stuck in this section and don't know why my code didn't work, can anybody explain it.
def digit_sum(n): total = 0 a = abs(n) for word in str(a): b = int(word) total += b return total