Digit_sum won't print


My code works, but won't print to the console

n = raw_input("Type a positive number")
def digit_sum(n):
    numbers = []
    for i in str(n): 
    numbers = sum(numbers[:])
    return numbers
    print numbers


print is unreachable after return.


Thanks! I didn't know that.


Actually, anything after return is unreachable unless it is elif or else, which goes along with a change of context.


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