In the console window, I get the following:
and an error message that says the following:
Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.
What I expected to happen is that my code would first convert the integer to a string and then iterate through that string, converting each element back into an integer and adding it to the variable total.
def digit_sum(n): n = str(n) total = 0 for x in n: total = total + int(x) print x digit_sum(1234)