Console output is correct but codecademy says it's wrong


My code runs perfectly in the console. I perform an int to string conversion and back. I pass the number 5678 to a function and the console reports the proper number: 26. But codecademy says the following:
Oops, try again. Your function fails on digit_sum(434). It returns None when it should return 11.

I expect an "att'a boy, your code ran perfectly." Because it did. The error didn't even test of the number i put in.

def digit_sum(n):
    int_to_string = str(n)
    string_to_int = 0
    for char in int_to_string:
        string_to_int = string_to_int + int(char)
    print string_to_int



Hi @cwinning,

your code is indeed correct :slight_smile: Atta boy!

Alas, there is a single word to change:

change print to return. That is all.


Darn, I should have caught that! Thank you very much.