Digit_sum error


This is my code:

def digit_sum(n):
for i in n:
return sum(m)

n=raw_input("positive number: ")
print digit_sum(n)

This code can achieve the function requirement, but always showed a 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.


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