The error I get is:
Oops, try again. Your function fails on digit_sum(434). It returns 4 when it should return 11.
So I assuming my code breaks down the string but only adds up the first i to total.
What I don't understand is why it only adds up the first i when I have it in a for.
The way I understand it is that when you write it as a for it should go through all the i's?
If anyone could clearify for my why this isn't working I would be greatful
def digit_sum(n): x = str(n) for i in x: total = 0 total += int(i) return total