Hello everyone, I am having some trouble with my code:
lst =  result =  def digit_sum(n): ns = str(n) for digt in ns: lst.append(digt) for num in lst: x = int(num) result.append(x) return sum(result) print digit_sum(1234)
When I input '1234' it prints out '10', which is correct (1+2+3+4 = 10) but then I get this error:
"Oops, try again. Your function fails on digit_sum(434). It returns 41 when it should return 11. "
Then I tried to input '434' to see what's wrong and it prints out '11', which is also correct (4+3+4 = 11) yet I get this error:
"Oops, try again. Your function fails on digit_sum(434). It returns 44 when it should return 11."
although the printed output is correct it still gives me errors.
Thanks in advance.