Hi everyone, need some help here.

here is my code:
def digit_sum(n)
return sum(n)

fyi return sum(n) is indented

and here is the error:

Oops, try again. Does your digit_sum function take exactly one argument (a positive integer)? Your code threw a "'int' object is not iterable" error.


sum() needs an iterable (like a list), it can't handle integer as input.

I am afraid, its back to the drawing board


is there any way you could point me in the right direction, without giving me the answer?


there is a hint in the exercise, which i think can push you in the right direction. I don't think i could do a much better job

If you then get stuck, post an updated version of your code so i can push you in the right direction


A post was split to a new topic: Digit_sum


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