Did I just go about this in a weird way? This is the simplest version my head came up with. Only problem is that when I run through the interface I'm hit with "Your function fails on digit_sum(434). It returns None when it should return 11." yet when I test this code in IDLE, calling digit_sum(434) returns 11 and not None. Where did I go wrong?
def digit_sum(n): x = str(n) sum_int = 0 for c in x[:]: sum_int += int(c) print(sum_int)