I've seen this code being used as a correct answer on other posts, but whenever I try to put it in I get the error message: "Oops, try again. Your function fails on digit_sum(434). It returns 4 when it should return 11."
def digit_sum(n): total = 0 for i in str(n): total += int(i) return total print digit_sum(12345)
Is anyone else having this problem? Any help would be greatly appreciated.