Digit_sum: How to print the sum in the output


def digit_sum(n):
n = str(abs(n))
print (n)
number_set = []
for i in n:
return (sum(number_set))

How to print the sum in the output?????


a function only executes when called, so call the function? To print what a function returns, add a print statement before the function call

in the exercise, you might get away with not adding print statement before function call


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