4. digit_sum


#1

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/0/4?curriculum_id=4f89dab3d788890003000096#

Error Message: Your function fails on digit_sum(434). It returns 4 when it should return 11.

```python

def digit_sum(n):
    num_str = str(n)
    for i in range(len(num_str)):
        total = 0
        total += int(num_str[i])
    return total

#2

did you check existing topics? I answered the exact same question today:

the code is too shocking similiar, or is that just me?


#3

Thank you for the link. But, I still manage to get the error somehow. Just that can’t work on the solution for return Total


#4

Well, anyhow got it working now. Thanks a lot for the hint!


#5