I used Textwrangler on my mac to complete this program step by step and it worked. I then copy pasted my code into the codecademy python interpreter, but I get an error message saying "Your function fails on digit_sum(434)" even though the program produces the correct sum! When I run the code on TextWrangler, no error messages pop up.
I am not sure what I'm doing wrong or if this is just a bug. Any help would be appreciated.
def digit_sum(n): #convert n into a string n = str(abs(n)) result =  new =  #add the characters of the string into an empty list, result for letter in n: result.append(letter) #convert the items in result into integers for digit in result: digit = int(digit) new.append(digit) print digit, print result print new print sum(new)