Hi all. Don't really understand why this isn't working.
From what I understand, the code in line 5 is supposed to add the incremental of 'num' within the parameter from index 0 to end of the parameter. (in this example, from index 0 to index 2)
Am I making a mistake somewhere?
thanks in advanced!
def digit_sum(x): x = str(x) for num in range(0,len(x)-1): ans = 0 ans += int(num) return ans