Hello to everyone. I have a problem with: digit_sum task.

I am a bit confused why codeacademy compilator does not want to accept my code. It works okay in my Python IDE. Could somebody of you be so kind and explain to me where I was wrong. Thank you so much.

def digit_sum(n):
    n = str(abs(n))
    print (n)
    number_set = []
    for i in n:


besides printing the sum of digits, you should also return it.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.