Can someone explain to me why my code is doing this and how to fix it?
def digit_sum(n): digit_string = str(n) for i in digit_string: digit_list.append(i) int_list = map(int, digit_list) sum_list = sum(int_list) print sum_list digit_sum(454)
Output is this
Error is: Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.
I am not sure how to get the last list, the one with all of the numbers in the list, instead of the numbers being put in individually and that list being displayed. To clarify, how can create just one list instead of multiple lists?