Digit_sum


#1

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.


#2

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

I am afraid, its back to the drawing board


#3

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


#4

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


#6

A post was split to a new topic: Digit_sum


#7

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