When I run this code, an error pops up. The error message reads, "Oops, try again. Your function fails on digit_sum(434). It returns 21 when it should return 11."
However, I believe my function should return 11. I'm not sure if something's wrong with the function or the end part when I did sum(list).
list1 =  def digit_sum(n): while n != 0: list1.append(n % 10) print list1 n = n // 10 return sum(list1) digit_sum(1234)
I have no idea how I'm getting this wrong. I've seen other codes in different discussions on this topic, however, I would like to try to solve this problem on my own...
It's just that I got too frustrated to see errors whenever I tried to fix it -
Please help me!! x(